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:
//package code;
import java.io.*;
import java.util.*;
import java.util.Map.Entry;
import java.text.*;
import java.math.*;
import java.util.regex.*;
import java.awt.Point;
/**
 *
 * @author prabhat // use stringbuilder,TreeSet, priorityQueue, x+y=(x&y + x|y);
 */
   public class  a
   {
   public static int n,max1=100005,k,m,q,set[];
   public static Point[] p1,p2;
   public static long mod=(long)1e9+7,nCr[][],dp[][][],pre[][],suf[][],a[];
   public static boolean[] isPrime;
   public static  ArrayList<Integer> divisor[],prime,adj[];
   public  static BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
   static PrintWriter pw;
   public  static void main(String[] args) throws Exception
   {
   	     InputReader in = new InputReader(System.in);
		 pw=new PrintWriter(System.out);
		  n=in.ii();
		  m=in.ii();
		  int[][]mat=in.iim(n,m);
		  int[][] mat1=mat;
		  int[][] mat2=mat;
		  int[][]a=new int[n][m];
		  if(n<m){
		  LinkedList<String> ans=new LinkedList<>();
		  for(int i=0;i<n;i++)
		  {
			 int x=Integer.MAX_VALUE;
			 for(int j=0;j<m;j++)x=Math.min(x,mat[i][j]);

			 for(int j=0;j<m;j++)mat[i][j]-=x;
			
			 for(int o=0;o<x;o++)ans.add("row"+" "+(i+1));
		  }
		
		 for(int i=0;i<m;i++)
		 {
			 int min=Integer.MAX_VALUE;
			 for(int j=0;j<n;j++)
			 {
                min=Math.min(min,mat[j][i]);
			 }
			
			for(int j=0;j<n;j++)mat[j][i]-=min;
			
			 for(int o=0;o<min;o++)ans.add("col"+" "+(i+1));
		}
		boolean  b=true;
		 for(int i=0;i<n;i++)
		 {
			 for(int j=0;j<m;j++)
			 {
				 if(mat[i][j]!=a[i][j])
				 {
					 b=false;
					 break;
				 }
			 }
			 if(!b)break;
		 }
		 if(b){
		 pw.println(ans.size());
		 for(String s:ans)pw.println(s);
		 }
		 else pw.println(-1);
		}
		else{
			LinkedList<String> ans=new LinkedList<>();

			for(int i=0;i<m;i++)
			{
				int min=Integer.MAX_VALUE;
				for(int j=0;j<n;j++)
				{
				   min=Math.min(min,mat[j][i]);
				}
			   
			   for(int j=0;j<n;j++)mat[j][i]-=min;
			   
				for(int o=0;o<min;o++)ans.add("col"+" "+(i+1));
		   }

			for(int i=0;i<n;i++)
			{
			   int x=Integer.MAX_VALUE;
			   for(int j=0;j<m;j++)x=Math.min(x,mat[i][j]);
  
			   for(int j=0;j<m;j++)mat[i][j]-=x;
			  
			   for(int o=0;o<x;o++)ans.add("row"+" "+(i+1));
			}
		  
		boolean	b=true;
		   for(int i=0;i<n;i++)
		   {
			   for(int j=0;j<m;j++)
			   {
				   if(mat[i][j]>0)
				   {
					   b=false;
					   break;
				   }
			   }
			   if(!b)break;
		   }
		   if(b){
		   pw.println(ans.size());
		   for(String s:ans)pw.println(s);
		   }
		   else pw.println(-1);
		}
		 //pw.println(Arrays.deepToString(a));
		 pw.close();
   }
  
   static class Pair{
	   int x;int y;
	   Pair(int a,int b)
	   {
		   x=a;
		   y=b;
	   }
   }
  
static long ncr(int i,int  j)
{
 if(j==0||i==j)return 1;
 if(nCr[i][j]!=-1)return nCr[i][j];
 long res=ncr(i-1,j-1)+ncr(i-1,j);
 return nCr[i][j]=res;
}
public  static class DSU
{
	int[] parent;
	int[] rank;
	int cnt;
	public DSU(int n){
		parent=new int[n];
		rank=new int[n];
		for(int i=0;i<n;i++){
			parent[i]=i;
			rank[i]=1;
		}
		cnt=n;
	}
	int find(int i){
		while(parent[i] !=i){
			parent[i]=parent[parent[i]];
			i=parent[i];
		}
		return i;
	}
	int Union(int x, int y){
		int xset = find(x);
		int yset = find(y);
		if(xset!=yset)
			cnt--;
		if(rank[xset]<rank[yset]){
			parent[xset] = yset;
			rank[yset]+=rank[xset];
			rank[xset]=0;
			return yset;
		}else{
			parent[yset]=xset;
			rank[xset]+=rank[yset];
			rank[yset]=0;
			return xset;
		}
	}
}

static int gcd(int a,int b)
{
	while(a!=0)
	{
		int temp=a;
		a=b%a;
		b=temp;
	}
	return b;
}
static void Seive()
{
	isPrime=new boolean[max1];
	Arrays.fill(isPrime,true);
	prime=new ArrayList<>();
	divisor=new ArrayList[max1];
	for(int i=1;i<max1;i++)divisor[i]=new ArrayList<Integer>();
    isPrime[0]=isPrime[1]=false;
	for(int i=2;i<(max1);i++)
	{
         if(isPrime[i]){
			 divisor[i].add(i);
			 prime.add(i);
			for(int j=2*i;j<max1;j+=i)
			{
				isPrime[j]=false;
				divisor[j].add(i);
			}
		}
	}
}
public static long pow(long n,long p)
{
	 long  result = 1;
	  if(p==0)
	    return 1;

	while(p!=0)
	{
	    if(p%2==1)
	        result *= n;
	    
	    p >>=1;
	    n*=n;
	}
	return result;
}


static  class InputReader
{
   private InputStream stream;
   private byte[] buf = new byte[1024];

   private SpaceCharFilter filter;
    byte inbuffer[] = new byte[1024];
   int lenbuffer = 0, ptrbuffer = 0;
    final int M = (int) 1e9 + 7;
   int md=(int)(1e7+1);
    int[] SMP=new int[md];
   final double eps = 1e-6;
   final double pi = Math.PI;

	PrintWriter out;
   String check = "";
 InputStream   obj = check.isEmpty() ? System.in : new ByteArrayInputStream(check.getBytes());
   public InputReader(InputStream stream)
   {
       this.stream = stream;
   }

    int readByte() {
	        if (lenbuffer == -1) throw new InputMismatchException();
	        if (ptrbuffer >= lenbuffer) {
	            ptrbuffer = 0;
	            try {
	                lenbuffer = obj.read(inbuffer);
	            } catch (IOException e) {
	                throw new InputMismatchException();
	            }
	        }
	        if (lenbuffer <= 0) return -1;
	        return inbuffer[ptrbuffer++];
   }

   public  int read()
   {
       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;
   }

   String is() {
	        int b = skip();
	        StringBuilder sb = new StringBuilder();
	        while (!(isSpaceChar(b))) // when nextLine, (isSpaceChar(b) && b!=' ')
	        {
	            sb.appendCodePoint(b);
	            b = readByte();
	        }
	        return sb.toString();
   }
   public   int ii() {
	        int num = 0, b;
	        boolean minus = false;
	        while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-')) ;
	        if (b == '-') {
	            minus = true;
	            b = readByte();
	        }
	        while (true) {
	            if (b >= '0' && b <= '9') {
	                num = num * 10 + (b - '0');
	            } else {
	                return minus ? -num : num;
	            }
	            b = readByte();
	        }
   }
 public   long il() {
	        long num = 0;
	        int b;
	        boolean minus = false;
	        while ((b = readByte()) != -1 && !((b >= '0' && b <= '9') || b == '-')) ;
	        if (b == '-') {
	            minus = true;
	            b = readByte();
	        }
	        while (true) {
	            if (b >= '0' && b <= '9') {
	                num = num * 10 + (b - '0');
	            } else {
	                return minus ? -num : num;
	            }
	            b = readByte();
	        }
   }

	    boolean isSpaceChar(int c) {
	        return (!(c >= 33 && c <= 126));
	       }

	      int skip()
	        {
	        int b;
	        while ((b = readByte()) != -1 && isSpaceChar(b)) ;
	        return b;
	        }

	    float nf() {
	        return Float.parseFloat(is());
	    }

	    double id() {
	        return Double.parseDouble(is());
	    }

	    char ic() {
	        return (char) skip();
	    }

	    int[] iia(int n) {
	        int a[] = new int[n];
	        for (int i = 0; i<n; i++) a[i] = ii();
	        return a;
	    }

	    long[] ila(int n) {
	        long a[] = new long[n];
	        for (int i = 0; i <n; i++) a[i] = il();
	        return a;
	    }

	    String[] isa(int n) {
	        String a[] = new String[n];
	        for (int i = 0; i < n; i++) a[i] = is();
	        return a;
	    }


		 long mul(long a, long b) { return a * b % M; }

		/*	long div(long a, long b)
				 {
					return mul(a, pow(b, M - 2,M));

		           }
*/


	    double[][] idm(int n, int m) {
	        double a[][] = new double[n][m];
	        for (int i = 0; i < n; i++) for (int j = 0; j < m; j++) a[i][j] = id();
	        return a;
	        }

	    int[][] iim(int n, int m) {
	        int a[][] = new int[n][m];
	        for (int i = 0; i < n; i++) for (int j = 0; j <m; j++) a[i][j] = ii();
	        return a;
          }


   public String readLine() {
       int c = read();
       while (isSpaceChar(c))
           c = read();
       StringBuilder res = new StringBuilder();
       do {
           res.appendCodePoint(c);
           c = read();
       } while (!isEndOfLine(c));
       return res.toString();
   }

   public interface SpaceCharFilter
   {
       public boolean isSpaceChar(int ch);
   }
   public boolean isEndOfLine(int c) {
       return c == '\n' || c == '\r' || c == -1;
   }
}

}