Problem: On the way to school, Karen became fixated on the puzzle game on her phone!

<image>

The game is played as follows. In each level, you have a grid with n rows and m columns. Each cell originally contains the number 0.

One move consists of choosing one row or column, and adding 1 to all of the cells in that row or column.

To win the level, after all the moves, the number in the cell at the i-th row and j-th column should be equal to gi, j.

Karen is stuck on one level, and wants to know a way to beat this level using the minimum number of moves. Please, help her with this task!

Input

The first line of input contains two integers, n and m (1 ≤ n, m ≤ 100), the number of rows and the number of columns in the grid, respectively.

The next n lines each contain m integers. In particular, the j-th integer in the i-th of these rows contains gi, j (0 ≤ gi, j ≤ 500).

Output

If there is an error and it is actually not possible to beat the level, output a single integer -1.

Otherwise, on the first line, output a single integer k, the minimum number of moves necessary to beat the level.

The next k lines should each contain one of the following, describing the moves in the order they must be done:

  * row x, (1 ≤ x ≤ n) describing a move of the form "choose the x-th row". 
  * col x, (1 ≤ x ≤ m) describing a move of the form "choose the x-th column". 



If there are multiple optimal solutions, output any one of them.

Examples

Input

3 5
2 2 2 3 2
0 0 0 1 0
1 1 1 2 1


Output

4
row 1
row 1
col 4
row 3


Input

3 3
0 0 0
0 1 0
0 0 0


Output

-1


Input

3 3
1 1 1
1 1 1
1 1 1


Output

3
row 1
row 2
row 3

Note

In the first test case, Karen has a grid with 3 rows and 5 columns. She can perform the following 4 moves to beat the level:

<image>

In the second test case, Karen has a grid with 3 rows and 3 columns. It is clear that it is impossible to beat the level; performing any move will create three 1s on the grid, but it is required to only have one 1 in the center.

In the third test case, Karen has a grid with 3 rows and 3 columns. She can perform the following 3 moves to beat the level:

<image>

Note that this is not the only solution; another solution, among others, is col 1, col 2, col 3.

Solution (in JAVA):

Solution:
import java.awt.List;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.math.RoundingMode;
import java.util.*;

public class Watermelon {
	public static void main(String[] args) throws IOException{
		Main m=new Main();
		m.solve();
	}
	}
class Main{
	
	 BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
	 private int[] array;
	    private int[] tempMergArr;
	    private int length;
	
	    BigInteger[] temp=new BigInteger[31];
		BigInteger x,y,z;
	    StringTokenizer stringTokenizer;

	     String next() throws IOException {
	        while (stringTokenizer == null || !stringTokenizer.hasMoreTokens()) {
	            stringTokenizer = new StringTokenizer(reader.readLine());
	        }
	        return stringTokenizer.nextToken();
	    }

	    int nextInt() throws IOException {
	        return Integer.parseInt(next());
	    }

	    long nextLong() throws IOException {
	        return Long.parseLong(next());
	    }
	    int[] marr=null;
	    Extra[] BIT=new Extra[10];
	    int[] arr=null;
	    int[][] lcsarr=null;
	    void solve() throws IOException  {
	    	int m=this.nextInt();
	    	int n=this.nextInt();
	    	int[][] arr=null;
	    	
	    	arr=new int[m][n];
	    	int[][] marr=new int[m][n];
	    	if(m<=n){
	    	ArrayList<Count> list=new ArrayList<>(); 
	    	int[] max=new int[n];
	    	for(int i=0;i<arr.length;i++)
	    		for(int j=0;j<arr[i].length;j++)
	    			{
	    			arr[i][j]=this.nextInt();
	    		
	    			}
	    	for(int i=0;i<arr.length;i++){
	    		int min=Integer.MAX_VALUE;
	    		for(int j=0;j<arr[i].length;j++){
	    			min=Math.min(arr[i][j], min);
	    		}
	    		
	    	    if(i==0)
	    	    	for(int j=0;j<arr[i].length;j++){
		    			max[j]=arr[i][j]-min;
		    			if(max[j]!=0)
		    				{
		    				while(max[j]!=0){
		    				list.add(new Count("col",j+1));
		    				max[j]--;
		    				}
		    				}
		    	    }
    		
	    		for(int j=min;j>0;j--)
	    		  list.add(new Count("row",i+1));
	    	}
	    	for(int i=0;i<list.size();i++){
	    		if(list.get(i).i.compareTo("col")==0)
	    		for(int j=0;j<m;j++){
	    			marr[j][list.get(i).j-1]++;
	    		}
	    		if(list.get(i).i.compareTo("row")==0)
		    		for(int j=0;j<n;j++){
		    			marr[list.get(i).j-1][j]++;
		    		}
	    	}
	    	for(int i=0;i<m;i++){
	    		for(int j=0;j<n;j++){
	    			if(marr[i][j]!=arr[i][j]){
	    				System.out.println(-1);
	    				System.exit(0);
	    			}
	    		}
	    	}
	    	//display(marr);
	    	System.out.println(list.size());
	    	for(int i=0;i<list.size();i++)
	    		list.get(i).display();
	    	}
	    	else{
	    		ArrayList<Count> list=new ArrayList<>(); 
		    	int[] max=new int[m];
		    	for(int i=0;i<arr.length;i++)
		    		for(int j=0;j<arr[i].length;j++)
		    			arr[i][j]=this.nextInt();
		    	for(int i=0;i<n;i++){
		    		int min=Integer.MAX_VALUE;
		    		for(int j=0;j<m;j++){
		    			min=Math.min(arr[j][i], min);
		    	    }
		    		
		    	    if(i==0)
		    	    	for(int j=0;j<m;j++){
			    			max[j]=arr[j][i]-min;
			    			if(max[j]!=0){
			    				while(max[j]!=0)
			    				{
			    					list.add(new Count("row",j+1));
			    				   max[j]--;
			    				}
					    	    	
			    			}
			    		}
	    		
		    		for(int j=min;j>0;j--)
		    		  list.add(new Count("col",i+1));
		    	}
		    	for(int i=0;i<list.size();i++){
		    		if(list.get(i).i.compareTo("col")==0)
		    		for(int j=0;j<m;j++){
		    			marr[j][list.get(i).j-1]++;
		    		}
		    		if(list.get(i).i.compareTo("row")==0)
			    		for(int j=0;j<n;j++){
			    			marr[list.get(i).j-1][j]++;
			    		}
		    	}
		    	for(int i=0;i<m;i++){
		    		for(int j=0;j<n;j++){
		    			if(marr[i][j]!=arr[i][j]){
		    				System.out.println(-1);
		    				System.exit(0);
		    			}
		    		}
		    	}
		    		System.out.println(list.size());
			    	
		    	for(int i=0;i<list.size();i++)
		    		list.get(i).display();
	    	}
	    	
	    }
       void recurs(int[][] arr,int count,int i,int j){
    	 }
	    static int max_LIS=0;
	   
	    public int LIS(int[] arr,int n){
	    	if(n==0)
	    		{
	    		marr[0]=1;
	    		return 1;
	    		}
	    	
	    	int current =1;
	    	for(int i=0;i<n;i++){
	    		int subproblem=0;
	    		if(marr[i]==0)
	    		{
	    			subproblem=LIS(arr,i);
	    			marr[i]=subproblem;
	    		}
	    		else{
	    		//	System.out.println("Hey");
	    			subproblem=marr[i];
	    		}
	    		
	    		System.out.println(current+" "+subproblem+" "+i);
	    		if(arr[i]<arr[n]&&current<(1+subproblem)){
	    			current=(1+subproblem);
	    		}
	    	}
	    	if(max_LIS<current)
	    		max_LIS=current;
	    	return current;
	    }
	    public int LCS1(int i,int j){
	    	System.out.println(i+" "+j+"hey");
	    	int n=0;
	    	if(i==-1||j==-1)
	    		return 0;
	    	if(arr[i]==marr[j])
	    		n=1+LCS1(i-1,j-1);
	    	else{
	    		n=Math.max(LCS1(i-1,j), LCS1(i,j-1));
	    	}
	    	return n;
	    }
	    public int LCS(int i,int j){
	    	System.out.println(i+" "+j);
	    	int n=0;
	    	if(i==-1||j==-1)
	    		return 0;
	    	if(arr[i]==marr[j])
	    		{
	    		if(i!=0&&j!=0){
	    		if(lcsarr[i-1][j-1]==0){
	    		n=1+LCS(i-1,j-1);
	    		lcsarr[i-1][j-1]=n-1;
	    		}
	    		else{
	    			n=1+lcsarr[i-1][j-1];
	    		}
	    		}
	    	else
	    		n=1+LCS(i-1,j-1);
	    		}
	    	else{
	    		int x,y=0;
	    		if(i!=0){
	    		
	    		if(lcsarr[i-1][j]==-1)
	    		{
	    			x=LCS(i-1,j);
	    			lcsarr[i-1][j]=x;
	    		}
	    		else{
	    			x=lcsarr[i-1][j];
	    		}
	    		}
	    		else
	    			x=LCS(i-1,j);
	    		if(j!=0){
	    		if(lcsarr[i][j-1]==-1){
	    		y=LCS(i,j-1);
	    		lcsarr[i][j-1]=y;
	    		}
	    		else{
	    			y=lcsarr[i][j-1];
	    		}
	    		}
	    		else
	    			y=LCS(i,j-1);
	    		n=Math.max(x, y);
	    	}
	    	return n;
	    }
	public BigInteger comb(int n,int r){
	     x=this.temp[n];
		 y=this.temp[r];
		 z=this.temp[n-r];
	//	 System.out.println(x+" "+y+" "+z);
		 BigInteger ret=x.divide(y.multiply(z));
		 return ret;
		 
	}
	public void fact(){
		this.temp[0]=BigInteger.ONE;
		this.temp[1]=BigInteger.ONE;
		for(int i=2;i<this.temp.length;i++){
			temp[i]=(temp[i-1].multiply(BigInteger.valueOf(i)));
		}
	}
	private static int gcd(int a, int b)
	{
	    while (b > 0)
	    {
	    	int temp = b;
	        b = a % b; // % is remainder
	        a = temp;
	    }
	    return a;
	}
	private static int lcm(int a, int b)
	{
	    return a * (b / gcd(a, b));
	}
	static int[] toFractionPos(int x,int y){
		int a=gcd(x,y);
		int[] arr={x/a,y/a};
		//display(arr);
		return arr;
	}
   
	static void display(int[][] arr){
		for(int i=0;i<arr.length;i++){
			for(int j=0;j<arr[i].length;j++){
				System.out.print(arr[i][j]+" ");
		}
			System.out.println();
		}
		System.out.println();
	}
	static void display(char[][] arr){
		for(int i=1;i<arr.length;i++){
			for(int j=1;j<arr[i].length;j++){
				System.out.print(arr[i][j]);
		}
			System.out.println();
		}
		System.out.println();
	}
	 static void display(String[] arr){
			for(int i=0;i<arr.length;i++){
				System.out.println(arr[i]+" ");
			}	
			//System.out.println();
		
	 }
	 static void display(int[] arr){
		 for(int i=0;i<arr.length;i++)
				System.out.print(arr[i]+" ");
		System.out.println();
		 }
	 static void display(Integer[] arr){
		 for(int i=arr.length-1;i>=0;i--)
				System.out.print(arr[i]+"");
		System.out.println();
		 }
		 static void display(double[] arr){
		 	   for(int i=0;i<arr.length;i++){
		 		   System.out.print(arr[i]+" ");
		 	   }
		 	   System.out.println();
	    }
	 static void display(char[] arr){
		// System.out.println();
		 int t=0;
			for(int i=0;i<arr.length;i++){
				if(arr[i]!='0'){t=i;break;}
			}	
			while(t!=arr.length){
				System.out.print(arr[t]);
				t++;
			}
			System.out.println();
		
		  }
	 static String str(char[] carr){
		 String str="";
		 for(int i=0;i<carr.length;i++){
			    str=str+carr[i];
			}
		 return str;
	 }
	    public void sort(int inputArr[]) {
	        this.array = inputArr;
	        this.length = inputArr.length;
	        this.tempMergArr = new int[length];
	        doMergeSort(0, length - 1);
	    }
	 
	    private void doMergeSort(int lowerIndex, int higherIndex) {
	         
	        if (lowerIndex < higherIndex) {
	            int middle = lowerIndex + (higherIndex - lowerIndex) / 2;
	            // Below step sorts the left side of the array
	            doMergeSort(lowerIndex, middle);
	            // Below step sorts the right side of the array
	            doMergeSort(middle + 1, higherIndex);
	            // Now merge both sides
	            mergeParts(lowerIndex, middle, higherIndex);
	        }
	    }
	 
	    private void mergeParts(int lowerIndex, int middle, int higherIndex) {
	 
	        for (int i = lowerIndex; i <= higherIndex; i++) {
	            tempMergArr[i] = array[i];
	        }
	        int i = lowerIndex;
	        int j = middle + 1;
	        int k = lowerIndex;
	        while (i <= middle && j <= higherIndex) {
	            if (tempMergArr[i] <= tempMergArr[j]) {
	                array[k] = tempMergArr[i];
	                i++;
	            } else {
	                array[k] = tempMergArr[j];
	                j++;
	            }
	            k++;
	        }
	        while (i <= middle) {
	            array[k] = tempMergArr[i];
	            k++;
	            i++;
	        }
	 
	    }
}


 class  Count implements Comparable {
    	    String i;
    	    Integer j;
            Integer k;
    	    Count(String i,int j){
    	        this.i=i;
    	        this.j=j;
    	        this.k=0;
    	    }
    	    public Count() {
				// TODO Auto-generated constructor stub
			}
		
			void display(){
    	    	System.out.println(i+" "+j);
    	    }
    	    
    	    	@Override
    		public int compareTo(Object o) {
    			// TODO Auto-generated method stub
    			Count c=(Count)o;
    			if(j.compareTo(c.j)>0)
    				return 1;
    			else if(j.compareTo(c.j)<0)
    				return -1;
    			else{
    				return 0;
    				
    			}
    		}
				
    		
    	}

 class  Counti implements Comparable {
    	    Integer i;
    	    int j;
    	    int k;
    	    Counti(int i,int j,int k){
    	        this.j=j;
    	        this.i=i;
    	        this.k=k;
    	    }
    	    void display(){
    	    	System.out.println(i+" "+j);
    	    }
    	    
    	    	@Override
    		public int compareTo(Object o) {
    			// TODO Auto-generated method stub
    			Counti c=(Counti)o;
    			if(i.compareTo(c.i)>0)
    				return 1;
    			else if(i.compareTo(c.i)<0)
    	    		return -1;
    			else
    				return 0;
    		}
    	}
		
 class Extra{
	 ArrayList<Integer> list=new ArrayList<>();
	 Extra(int i){
		 
	 }
	 public Extra() {
		// TODO Auto-generated constructor stub
	}
	void display(){
		 System.out.print(list.size()+" ");
		 for(int i=0;i<list.size();i++){
			 System.out.print(list.get(i)+" ");
		 }
		 System.out.println();
	 }
 }