import java.io.ByteArrayInputStream;
import java.nio.charset.StandardCharsets;
import java.util.Scanner;

public class ReproIO {
  public static void main(String[] args) {
    for (int run = 0; run < 3; run++ ) {
      String simulated = "Run " + run + "\nhello world\nsecond line\n";
      System.out.println("RUN " + run);
      ByteArrayInputStream bais = new ByteArrayInputStream(simulated.getBytes(StandardCharsets.UTF_8));
      System.setIn(bais);
      String line;
      while ((line = IO.readln()) != null)
        IO.println("Read: " + line);
    }
    for (int run = 3; run < 6; run++ ) {
      String simulated = "Run " + run + "\nhello world\nsecond line\n";
      System.out.println("RUN " + run);
      ByteArrayInputStream bais = new ByteArrayInputStream(simulated.getBytes(StandardCharsets.UTF_8));
      System.setIn(bais);
      Scanner s = new Scanner(System.in);
      while (s.hasNextLine())
        IO.println("Read: " + s.nextLine());
    }
  }
}