/***********************************************
 * icfpc-2011
 * بِسْمِ اللهِ الرَّحْمنِ الرَّحِيمِِ
 * Time: 18.06.2011 11:37:46
 ***********************************************/
package ru.alphatech.icfpc.game;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.LinkedList;
import java.util.List;

public class Run
{
	private static boolean endgame = false;
	
	private static Player proponent = new Player();
	
	private static Player opponent = new Player();
	
	private static LinkedList<Batch> batches = new LinkedList<Batch>();
	
	private static int registers[] = new int[4];
	
	static {
		registers[0] = 0;
		registers[1] = 1;
		registers[2] = 2;
		registers[3] = 3;
	}
	
	public static Slot getRegisterByIndex(int registerIdex){
		return proponent.getSlot( registers[registerIdex] );
	}
	
	public static void clearBatcher(){
		batches.removeAll(batches);
	}
	
	public static void addBatcher(List<Batch> batches){
		batches.addAll(batches);
	}
	
	public static Player getOpponent(){
		return opponent;
	}
	
	public static Player getProponent(){
		return proponent;
	}
	
	private static void readOpponent() throws IOException
	{
		BufferedReader breader = new BufferedReader(new InputStreamReader(System.in));
		String turnCase = breader.readLine();
		String card = null;
		String slot = null;
		
		if("1".equals(turnCase))
		{
			card = breader.readLine();
			slot = breader.readLine();
		}
		else if("2".equals(turnCase))
		{
			slot = breader.readLine();
			card = breader.readLine();
		}
		else
		{
			// do nothing
		}
		
		if(turnCase == null || card == null || slot == null)
		{
			endgame = true;
		}
	}
	
	private static void writeMove()
    {
		System.out.print(1 + "\n");
		System.out.print("I" + "\n");
		System.out.print(0 + "\n");
    }
	
	public static void main(String[] args) throws IOException
    {
	    String playerNum = args[0];

	    if("1".equals(playerNum))
	    {
	    	readOpponent();
	    }
	    
	    while(!endgame)
	    {
		    writeMove();
		    readOpponent();
	    }
    }
}
