
import java.net.*;
import java.io.*;
import java.util.*;

class Warden {
  public static void main(String[] args) throws Exception {
    String host = "localhost";
    int port = 12345;
    Socket s = new Socket(host, port);

    PrintWriter pw = new PrintWriter(s.getOutputStream());
    Scanner sc = new Scanner(s.getInputStream());
    Random rnd = new Random();

    for (int i = 0; i < 5; i++) {
      int sleep_sec = rnd.nextInt(4) + 2; //rnd(0-3) + 2
      Thread.sleep(sleep_sec * 1000); // second to milisecond conversion
      int val = rnd.nextInt(10) + 1;
      pw.println(val);
      int index = rnd.nextInt(10) + 1;
      pw.println(index);
      pw.flush();
      System.out.println("The warden visited feeder #" + index
                         + " and filled it with " + val + " amount of food.");
    }

    pw.close();
    sc.close();
    s.close();
  }
}