// package pic20b;

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


public class Server1 {

    public static void main(String[] args) throws IOException {

	final int qLen = 6;
	final int port = 4444;
	String query = "How are you?";
	String reply;
	Socket sock;
	ServerSocket servsock = new ServerSocket(port, qLen);

	while (true) {
	    sock = servsock.accept();
	    PrintStream sout = new PrintStream(sock.getOutputStream());
	    BufferedReader sin = new BufferedReader(
		    new InputStreamReader(sock.getInputStream()));
	    sout.println(query);
	    sout.flush();
	    reply = sin.readLine();

	    if (reply.indexOf("thank") > -1) {
		System.out.println("Nice Person");
	    } else {
		System.out.println("Probably an AI experiment");
	    }

	    sock.close();

	}

    }

}
