import java.io.*;
import java.net.*;

public class DatagramClnt {
    public static void main( String[] args ) throws IOException{
        BufferedReader stdin = new BufferedReader(
                 new InputStreamReader( System.in ) );
        DatagramSocket ds; DatagramPacket dp;
        InetAddress ia; int port; byte[] buf;

        ia = InetAddress.getByName( args[0] );
        port = Integer.parseInt( args[1] );
        ds = new DatagramSocket();

        String line = null;
        while ( (line=stdin.readLine()) != null ) {
            buf = line.getBytes();
            dp =  new DatagramPacket( buf, buf.length, ia, port );
            ds.send( dp );
        }
    }
}
