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.Checkbox;
import java.awt.Point;
import java.io.*;
        		    import java.math.*;
        		    import java.util.*;
        		    import javax.print.attribute.SetOfIntegerSyntax;
     
     
     
        		    public class LIS{
        		    	private static InputStream stream;
        		    	private static byte[] buf = new byte[1024];
        		    	private static int curChar;
        		    	private static int numChars;
        		    	private static SpaceCharFilter filter;
        		    	private static PrintWriter pw;
        		    	private static long count = 0,mod=1000000007;
        		    //	private static TreeSet<Integer> ts=new TreeSet[200000];
 
    		        public static void main(String[] args) {
    		        	InputReader(System.in);
    		    		pw = new PrintWriter(System.out); 
    		            new Thread(null ,new Runnable(){
    		               public void run(){
    		                   try{
    		                       solve();
    		                       pw.close();
    		                   } catch(Exception e){
    		                       e.printStackTrace();
    		                   }
    		               }
    		           },"1",1<<26).start();
   }
    public static void Merge(long a[],int p,int r){
        if(p<r){
            int q = (p+r)/2;
            Merge(a,p,q);
            Merge(a,q+1,r);
            Merge_Array(a,p,q,r);
        }
    }
    public static void Merge_Array(long a[],int p,int q,int r){
       long b[] = new long[q-p+1];
        long c[] = new long[r-q];
        for(int i=0;i<b.length;i++)
            b[i] = a[p+i];
        for(int i=0;i<c.length;i++)
            c[i] = a[q+i+1];
        int i = 0,j = 0;
        for(int k=p;k<=r;k++){
            if(i==b.length){
                a[k] = c[j];
                j++;
            }
            else if(j==c.length){
                a[k] = b[i];
                i++;
            }
            else if(b[i]<c[j]){
                a[k] = b[i];
                i++;
            }
            else{
                a[k] = c[j];
                j++;
            }
        }
    }
	public static long gcd(long x, long y) {
		if (x == 0)
			return y;
		else
			return gcd( y % x,x);
	}	public static boolean isPrime(int n) {
	// Corner cases
		if (n <= 1)
			return false;
		if (n <= 3)
			return true;
 
		// This is checked so that we can skip 
// middle five numbers in below loop
		if (n % 2 == 0 || n % 3 == 0)
			return false;
 
		for (int i = 5; i * i <= n; i = i + 6)
			if (n % i == 0 || n % (i + 2) == 0)
				return false;
 
		return true;
	}
	public static void test(){
		int t=nextInt();
		while(t-->0){
			solve();
		}
	}
      
        public static void solve() {
  
        	
        	int n=nextInt();
        	int m=nextInt();
        	long a[][]=next2dArray(n, m);
        	long b[][]=new long[n][m];
       
        	for(int i=0;i<n;i++){
        		for(int j=0;j<m;j++){
        			b[i][j]=a[i][j];
        		}
        	}
        	int cnt1=check(n, m, a);
        	int cnt2=check2(n, m, b);
        	
        	if(cnt2==Integer.MAX_VALUE && cnt1==Integer.MAX_VALUE){
        		System.out.println(-1);
        		System.exit(0);
        	}
        	if(cnt1<=cnt2){
        		pw.println(cnt1);
                
        		pw.println(sb);
        	}else if(cnt2<cnt1){
        		pw.println(cnt2);
        		pw.println(sb2);
        		
        	}
        	
        }
        static StringBuilder sb=new StringBuilder();
        public static int check(int n,int m,long a[][]){
int cnt=0;
        	for(int i=0;i<n;i++){
        		
        		long min=600;
        		for(int j=0;j<m;j++){
        			min=Math.min(a[i][j], min);
        		}
        		for(int j=0;j<m;j++){
        				a[i][j]-=min;
        		}
        		for(int j=0;j<min;j++){
        		cnt++;
        			sb.append("row "+(i+1)+"\n");
        		}
        	}
        	
        	for(int i=0;i<m;i++){
        		long min=600;
        		for(int j=0;j<n;j++){
        			min=Math.min(a[j][i], min);
        		}
        		for(int j=0;j<n;j++){
    				a[j][i]-=min;
    		}
        		for(int j=0;j<min;j++){
        			cnt++;
        			sb.append("col "+(i+1)+"\n");
        		}
        	}
        	for(int i=0;i<n;i++){
        		for(int j=0;j<m;j++){
        			if(a[i][j]!=0){
        	return Integer.MAX_VALUE;
        			}
        		}
        	}
        	return cnt;
        }
        static StringBuilder sb2=new StringBuilder();
        public static int check2(int n,int m,long a[][]){

        	int cnt=0;
        	for(int i=0;i<m;i++){
        		long min=600;
        		for(int j=0;j<n;j++){
        			min=Math.min(a[j][i], min);
        		}
        		for(int j=0;j<n;j++){
    				a[j][i]-=min;
    		}
        		for(int j=0;j<min;j++){
        			cnt++;
        			sb2.append("col "+(i+1)+"\n");
        		}
        	}
	for(int i=0;i<n;i++){
        		
        		long min=600;
        		for(int j=0;j<m;j++){
        			min=Math.min(a[i][j], min);
        		}
        		for(int j=0;j<m;j++){
        				a[i][j]-=min;
        		}
        		for(int j=0;j<min;j++){
        		cnt++;
        			sb2.append("row "+(i+1)+"\n");
        		}
        	}
	for(int i=0;i<n;i++){
		for(int j=0;j<m;j++){
			if(a[i][j]!=0){
		return Integer.MAX_VALUE;
			}
		}
	}
        	return  cnt;
        }
        public static long pow(long n, long p,long mod) {
			if(p==0)
				return 1;
			if(p==1)
				return n%mod;
			if(p%2==0){
				long temp=pow(n, p/2,mod);
			return (temp*temp)%mod;
			}else{
				 	long temp=pow(n,p/2,mod);
				 	temp=(temp*temp)%mod;
				 	return(temp*n)%mod;
				 	
			}
		}
    
		        
		        
        public static int LCS(String a,String b){
        	int dp[][]=new int [a.length()+1][b.length()+1];
        	for(int i=0;i<a.length();i++){
        		for(int j=0;j<b.length();j++){
        			if(a.charAt(i)==b.charAt(j)){
        				dp[i+1][j+1]=1+dp[i][j];
        			}else{
        				dp[i+1][j+1]=Math.max(dp[i][j+1], dp[i+1][j]);
        			}
        		}
        	}
        	return dp[a.length()][b.length()];
        }
      
        public static String reverseString(String s) {
			StringBuilder sb = new StringBuilder(s);
			sb.reverse();
			return (sb.toString());
		}
  
    		       
// To Get Input
// Some Buffer Methods
 
    		     	public static void sort(long a[]){
    		     		Merge(a, 0, a.length-1);
    		     	}
    		    	public static void InputReader(InputStream stream1) {
    		    		stream = stream1;
    		    	}
 
    		    	private static boolean isWhitespace(int c) {
    		    		return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
    		    	}
 
    		    	private static boolean isEndOfLine(int c) {
    		    		return c == '\n' || c == '\r' || c == -1;
    		    	}
 
    		    	private static int read() {
    		    		if (numChars == -1)
    		    			throw new InputMismatchException();
    		    		if (curChar >= numChars) {
    		    			curChar = 0;
    		    			try {
    		    				numChars = stream.read(buf);
    		    			} catch (IOException e) {
    		    				throw new InputMismatchException();
    		    			}
    		    			if (numChars <= 0)
    		    				return -1;
    		    		}
    		    		return buf[curChar++];
    		    	}
 
    		    	private static int nextInt() {
    		    		int c = read();
    		    		while (isSpaceChar(c))
    		    			c = read();
    		    		int sgn = 1;
    		    		if (c == '-') {
	sgn = -1;
	c = read();
}
int res = 0;
do {
	if (c < '0' || c > '9')
	throw new InputMismatchException();
res *= 10;
res += c - '0';
    		    			c = read();
    		    		} while (!isSpaceChar(c));
    		    		return res * sgn;
    		    	}
 
    		    	private static long nextLong() {
    		    		int c = read();
    		    		while (isSpaceChar(c))
    		    			c = read();
    		    		int sgn = 1;
    		    		if (c == '-') {
	sgn = -1;
	c = read();
}
long res = 0;
do {
	if (c < '0' || c > '9')
	throw new InputMismatchException();
res *= 10;
res += c - '0';
    		    			c = read();
    		    		} while (!isSpaceChar(c));
    		    		return res * sgn;
    		    	}
 
    		    	private static String nextToken() {
    		    		int c = read();
    		    		while (isSpaceChar(c))
    		    			c = read();
    		    		StringBuilder res = new StringBuilder();
    		    		do {
    		    			res.appendCodePoint(c);
    		    			c = read();
    		    		} while (!isSpaceChar(c));
    		    		return res.toString();
    		    	}
 
    		    	private static String nextLine() {
    		    		int c = read();
    		    		while (isSpaceChar(c))
    		    			c = read();
    		    		StringBuilder res = new StringBuilder();
    		    		do {
    		    			res.appendCodePoint(c);
    		    			c = read();
    		    		} while (!isEndOfLine(c));
    		    		return res.toString();
    		    	}
 
    		    	private static int[] nextIntArray(int n) {
    		    		int[] arr = new int[n];
    		    		for (int i = 0; i < n; i++) {
    		    			arr[i] = nextInt();
    		    		}
    		    		return arr;
    		    	}
 
    		    	private static long[][] next2dArray(int n, int m) {
    		    		long[][] arr = new long[n][m];
    		    		for (int i = 0; i < n; i++) {
    		    			for (int j = 0; j < m; j++) {
    		    				arr[i][j] = nextLong();
    		    			}
    		    		}
    		    		return arr;
    		    	}
    		    	private static char[][] nextCharArray(int n,int m){
    		    		char [][]c=new char[n][m];
    		    		for(int i=0;i<n;i++){
    		    			String s=nextLine();
    		    			for(int j=0;j<s.length();j++){
    		    				c[i][j]=s.charAt(j);
    		    			}
    		    		}
    		    		return c;
    		    	}
 
    		    	private static long[] nextLongArray(int n) {
    		    		long[] arr = new long[n];
    		    		for (int i = 0; i < n; i++) {
    		    			arr[i] = nextLong();
    		    		}
    		    		return arr;
    		    	}
 
    		    	private static void pArray(int[] arr) {
    		    		for (int i = 0; i < arr.length; i++) {
    		    			pw.print(arr[i] + " ");
    		    		}
    		    		pw.println();
    		    		return;
    		    	}
 
    		    	private static void pArray(long[] arr) {
    		    		for (int i = 0; i < arr.length; i++) {
    		    			pw.print(arr[i] + " ");
    		    		}
    		    		pw.println();
    		    		return;
    		    	}
 
    		    	private static void pArray(boolean[] arr) {
    		    		for (int i = 0; i < arr.length; i++) {
    		    			pw.print(arr[i] + " ");
    		    		}
    		    		pw.println();
    		    		return;
    		    	}
 
    		    	private static boolean isSpaceChar(int c) {
    		    		if (filter != null)
    		    			return filter.isSpaceChar(c);
    		    		return isWhitespace(c);
    		    	}
 
    		    	private interface SpaceCharFilter {
    		    		public boolean isSpaceChar(int ch);
    		    	}
        		    }
    		    	 class Pair implements Comparable<Pair>{
	        				
	    					
	    					int start,end;
	    					Pair(int start,int end){
	    					
	    						this.start=start;
	    						this.end=end;
	    					
	    					}
	    					@Override
	    					public int compareTo(Pair o) {
	    				
	    							
	    					
	    						if(start!=o.start)
	    						return (start-o.start);
	    						else
	    							return end-o.end;
	    					}
	    					public int hashCode() {
	    							//int hu = (int) (x ^ (x >>> 32));
	    							//int hv = (int) (y ^ (y >>> 32));
	    							//int hw = (int) (mass ^ (mass >>> 32));
	    							//return 31 * hu + hv ;
	    						return 0;
	    						}
	    						public boolean equals(Object o) {
	    							Pair other = (Pair) o;
	    						//	return x == other.x && y == other.y;
	    						return false;
	    						}
	    				}