import java.util.*;
import java.io.*;

public class TwoDArray
{

	private static BufferedReader stdin = new BufferedReader( new InputStreamReader( System.in ) );
	
	public static int[][] data;
	public static int[] sizes;
	
	public static void initialize()
	{
		data = new int[1000][10];
		sizes = new int[1000];

		for(int i = 0; i < 1000; i++)
			sizes[i] = 0;
	}


	public static void insert(int number)
	{
		int location = (number-1) / 1000;
		if(data[location].length == sizes[location])
		{
			int[] temp;
			temp = new int[sizes[location]*2+1];


			for(int i = 0; i < sizes[location]; i++)
				temp[i] = data[location][i];

			data[location] = temp;
		}
	
		data[location][sizes[location]] = number;
		sizes[location]++;

	}
	
	public static int search(int[][] data, int[] sizes, int number)
	{
		int location = (number-1)/1000;

		for(int i = 0; i < sizes[location]; i++)
			if(number == data[location][i])
				return i;

		return -1;
	}
	
	public static void main(String[] args)
	{
		// Initialize structure
		initialize();


		// read and insert until no more numbers
		while(true)
		{
            		// Prompt the user
            		System.out.println( "Type a number you want to insert. " );
            		System.out.print( "The number should be in the range 1..1000000:  " );
			
			try{

            			// Read a line of text from the user.
            			String input = stdin.readLine();

				// converts a String into an int value
				int number = Integer.parseInt( input ); 

				if(number <= 0)
					break;

				// insert the number into data
				insert(number);

			}
                        catch(java.io.IOException e)
                        {
                                System.out.println(e);
                        }


		}


                // read and search until no more numbers
                while(true)
                {
                        // Prompt the user
                        System.out.println( "Type a number you want to search for. " );
                        System.out.print( "The number should be in the range 1..1000000:  " );

                        try{

                                // Read a line of text from the user.
                                String input = stdin.readLine();

                                // converts a String into an int value
                                int number = Integer.parseInt( input );

                                if(number <= 0)
                                        break;

                                // search for the number into data
                                int column = search(data, sizes, number);
				if(column >= 0)
				{	
					System.out.println("row "+(number-1)/1000);
					System.out.println("column "+column);
				}
				else
					System.out.println("Number not found.");
					

                        }
                        catch(java.io.IOException e)
                        {
                                System.out.println(e);
                        }


                }



	}
}
