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:
/* Nice question 
My Solution : 

step 1) find minimum for each row
step 2) subtracts minimum element of the given row from each element of the row.
step 3) find the minimum for each column 
step 4) now subtract the minimum element of the given column from each element of the column.
step 5) if any element of the matrix is non-zero then solution does not exist otherwise 
        add minimum for each row and column to the answer. let it be ar

repeat the same steps starting with column. let the answer in this case is ac

take minimum of ac and ar
*/
import java.util.*;
import java.io.*;
public class lp1{  
static int solverow(int mat[][] ,int n,int m,int row[],int col[])
{
     
  int ans=0;
  for(int j=0;j<m;j++){
     int min = 99900000; 
     for(int i=0;i<n;i++)
         if(min>(mat[i][j]-row[i]))
            min = mat[i][j]-row[i];
            col[j]=min; ans = ans+col[j];
      }  
  for(int i=0;i<n;i++)
     ans = ans+row[i];
   return ans;
}
static int solvecol(int mat[][] ,int n,int m,int col[],int row[])
{
  int ans=0;
  for(int i=0;i<n;i++){
     int min = 99900000; 
     for(int j=0;j<m;j++)
         if(min>(mat[i][j]-col[j]))
            min = mat[i][j]-col[j];
            row[i]=min; ans = ans+row[i];
      }  
  for(int i=0;i<m;i++)
     ans = ans+col[i];
   return ans;
}
public static void main(String[] args){
 int n = ni();
 int m = ni();
 int mat[][] = new int[n][m];
 int row1[] = new int[n];
 int col1[] = new int[m];
 int row2[] = new int[n];
 int col2[] = new int[m];
 for(int i=0;i<n;i++){
     int min = 10000000;
   for(int j=0;j<m;j++)
     {
          mat[i][j] = ni();
          if(min>mat[i][j])
             min = mat[i][j];
     }
     row1[i]=min;
 }
  for(int j=0;j<m;j++){
      int min = 1000000;
    for(int i=0;i<n;i++)
       if(min>mat[i][j])
          min = mat[i][j];
     col1[j]=min;
  }
 int ar = solverow(mat,n,m,row1,col2);
 int ac = solvecol(mat,n,m,col1,row2);
 int flag=1;
 for(int i=0;i<n;i++)
  for(int j=0;j<m;j++)
    if((mat[i][j]-row1[i]-col2[j])!=0)
       { flag=-1; break;}
 if(flag==-1)
   pn(flag);
else{
 if(ar<ac)
   {
      pn(ar);
      for(int i=0;i<n;i++)
       for(int j=0;j<row1[i];j++)
        pn("row "+(i+1));

      for(int i=0;i<m;i++)
       for(int j=0;j<col2[i];j++)
        pn("col "+(i+1));
   }
 else
 {
       pn(ac);
      for(int i=0;i<n;i++)
       for(int j=0;j<row2[i];j++)
        pn("row "+(i+1));

      for(int i=0;i<m;i++)
       for(int j=0;j<col1[i];j++)
        pn("col "+(i+1));
  }
}
   out.flush();
}
 
static class pair
	{
		int a,b;
		pair(){}
		pair(int c,int d){a=c;b=d;}
		@Override
		public int hashCode(){return (a+" "+b).hashCode();}
		@Override public boolean equals(Object c){if(a==((pair)c).a&&b==((pair)c).b)return true;return false;}
	} 
static int get(int index)
        {
                return (index&(-index));
        }
static void add(int bit[],int index,int val)
        {
             while(index<bit.length)
               {
                    bit[index] = bit[index]+val;
                    index = index + get(index);
               }
        }
static int get(int bit[],int index)
         {
               int sum=0;
               while(index>0)
                {
                    sum = sum+bit[index];
                    index = index-get(index);
                }
              return sum;
         }
static void add(long bit[],int index,long val)
        {
             while(index<bit.length)
               {
                    bit[index] = bit[index]+val;
                    index = index + get(index);
               }
        }
static long get(long bit[],int index)
         {
               long sum=0;
               while(index>0)
                {
                    sum = sum+bit[index];
                    index = index-get(index);
                }
              return sum;
         } 
static void compress(int a[])
         {      
                int n = a.length;
                Integer ar[] = new Integer[n];
                for(int i=0;i<n;i++)
                     ar[i] = a[i];
                Arrays.sort(ar);
                HashMap<Integer,Integer> hm = new HashMap();
                int st=1;
                for(int i=0;i<n;i++)
                    if(!hm.containsKey(ar[i]))
                        hm.put(ar[i],st++);
                for(int i=0;i<n;i++)
                   a[i] = hm.get(a[i]);
         }
static int find(int x,int p[]){ if(x==p[x]) return x; return p[x]=find(p[x],p) ;}
static void union(int x,int y,int p[]){ int xr=find(x,p),yr=find(y,p); if(xr!=yr){ p[xr]=yr;} }
 
static int abs(int x){ return x>0 ? x : -x; }
static long abs(long x){ return x>0 ? x : -x; }
static long gcd(long a,long b){ if(a==0)return b; if(b==0) return a;if(b%a==0) return a;return gcd(b%a,a); }
static int gcd(int a,int b){ if(a==0)return b; if(b==0) return a; if(b%a==0) return a;return gcd(b%a,a); }
static long min(long a,long b){ return a<b ? a : b; }
static int min(int a,int b){ return a<b ? a : b; }
static long max(long a,long b){ return a>b ? a : b; }
static int max(int a,int b){ return a>b ? a : b; }
static long pow(long a,long b,long md){ long ans=1;  while(b>0){if(b%2==1) ans = (ans*a)%md; a = (a*a)%md; b = b/2;} return ans; }
static int log2n(long a){ int te=0; while(a>0) {a>>=1; ++te; } return te; }
 
 
static void subtract_1(char s[]){if(s[0]=='0') return;int n = s.length,i=n-1;while(s[i]=='0')i--;s[i] =(char)((int)(s[i]-'0') + 47);for(int j=i+1;j<n;j++)s[j]='9';}
static void reverse(char s[]){int i1=0,i2=s.length-1; while(i1<i2){char t=s[i1];s[i1]=s[i2];s[i2]=t; i1++;i2--;} }
static String reverse(String r){String s = "";int i= r.length()-1; while(i>=0){ s=s+r.charAt(i);i--;}return s;}
static boolean pal(char s[]){ int i1=0,i2=s.length-1; while(i1<i2){ if(s[i1]!=s[i2]) return false; i1++;i2--;} return true;}
static boolean pal(String s){int n = s.length(),i1=0,i2=n-1;while(i1<i2){if(s.charAt(i1)!=s.charAt(i2))return false;i1++; i2--;}return true;}
 
// Input OutPut Functions
static PrintWriter out = new PrintWriter(System.out);
static FastReader sc=new FastReader();
static int ni(){ int x = sc.nextInt();return(x); }
static long nl(){ long x = sc.nextLong(); return(x); }
static String n(){ String str = sc.next(); return(str); }
static String ns(){ String str = sc.nextLine(); return(str);}
static double nd(){double d = sc.nextDouble(); return(d); }
static int[] ai(int n){ int a[] = new int[n]; for(int i=0;i<n;i++) a[i] = ni(); return a; }
static long[] al(int n) {long a[] = new long[n]; for(int i=0;i<n;i++) a[i] = nl(); return a; }
static double[] ad(int n) { double a[]= new double[n]; for(int i=0;i<n;i++) a[i]=nd(); return a;} 
static void p(Object o){ out.print(o); }
static void pn(Object o){ out.println(o); } 
 
static class FastReader{ 
BufferedReader br; 
StringTokenizer st;   
public FastReader() { br = new BufferedReader(new InputStreamReader(System.in));  }   
String next(){while(st==null || !st.hasMoreElements()){try{st = new StringTokenizer(br.readLine());}catch (IOException  e){e.printStackTrace();}}return st.nextToken();} 
int nextInt(){ return Integer.parseInt(next()); } 
long nextLong(){ return Long.parseLong(next()); } 
double nextDouble(){return Double.parseDouble(next()); } 
String nextLine(){ String str = ""; try{ str = br.readLine();} catch (IOException e){ e.printStackTrace();} return str;} 
  } 
}