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.
import java.io.*;
	import java.math.BigInteger;
	import java.math.RoundingMode;
	import java.text.DecimalFormat;
	import java.util.*;
	
	
	public class Solution
	{
	
		static double eps=(double)1e-6;
		static long mod=(int)1e9+7;
		//static int arr[] =new int[1000001];
		public static void main(String args[]){
			InputReader sc = new InputReader(System.in);
			//Scanner sc=new Scanner(System.in);
			OutputStream outputStream = System.out;
			PrintWriter out = new PrintWriter(outputStream);
			//----------my cooooooooooode----------
			int n=sc.nextInt();
			int m=sc.nextInt();
			int a[][]=new int[n][m];
			int min=Integer.MAX_VALUE;
			for(int i=0;i<n;i++)
				for(int j=0;j<m;j++)
				{
					a[i][j]=sc.nextInt();
					min=Math.min(min, a[i][j]);
				}
			for(int i=0;i<n;i++)
				for(int j=0;j<m;j++)
				{
					a[i][j]-=min;
					//out.print(a[i][j]+" ");
				}
			if(n<=m)
			{
			int mi[]=new int[n];
			int mj[]=new int[m];
			for(int i=0;i<n;i++)
				mi[i]=Integer.MAX_VALUE;
			for(int j=0;j<m;j++)
				mj[j]=Integer.MAX_VALUE;
				for(int i=0;i<n;i++)
				{
					for(int j=0;j<m;j++)
					{
						mi[i]=Math.min(mi[i],a[i][j]);
					}
					//out.println(mi[i]);
					for(int j=0;j<m;j++)
					{
						a[i][j]-=mi[i];
					}
				}
				for(int i=0;i<m;i++)
				{
					for(int j=0;j<n;j++)
					{
						mj[i]=Math.min(mj[i],a[j][i]);
					}
					//out.println(mj[i]);
					for(int j=0;j<n;j++)
					{
						a[j][i]-=mj[i];
					}
				}
				int max=0;
				for(int i=0;i<n;i++)
				{
					for(int j=0;j<m;j++)
					{
						max=Math.max(a[i][j],max);
					}
				}
				if(max==0){
				int count=0;
				for(int i=0;i<n;i++)
					count+=mi[i];
				for(int j=0;j<m;j++)
					count+=mj[j];
				count+=min*n;
				out.println(count);
				for(int i=0;i<n;i++)
				{
					while(mi[i]>0)
					{
						out.println("row "+(i+1));
						mi[i]--;
					}
				}
				for(int j=0;j<m;j++)
				{
					while(mj[j]>0)
					{
						out.println("col "+(j+1));
						mj[j]--;
					}
				}
				for(int j=0;j<min;j++){for(int i=0;i<n;i++)
					out.println("row "+(i+1));
				}}
				else
					out.println("-1");
			}
			//int sum=0;
			else
			{
			int mj[]=new int[m];
			int mi[]=new int[n];
			for(int i=0;i<n;i++)
				mi[i]=Integer.MAX_VALUE;
			for(int j=0;j<m;j++)
				mj[j]=Integer.MAX_VALUE;
			for(int i=0;i<m;i++)
			{
				for(int j=0;j<n;j++)
				{
					mj[i]=Math.min(mj[i],a[j][i]);
				}
				for(int j=0;j<n;j++)
				{
					a[j][i]-=mj[i];
				}
			}
				for(int i=0;i<n;i++)
				{
					for(int j=0;j<m;j++)
					{
						mi[i]=Math.min(mi[i],a[i][j]);
					}
					for(int j=0;j<m;j++)
					{
						a[i][j]-=mi[i];
					}
				}
				int max=0;
				for(int i=0;i<n;i++)
				{
					for(int j=0;j<m;j++)
					{
						max=Math.max(a[i][j],max);
					}
				}
				if(max==0){
				int count=0;
				for(int i=0;i<n;i++)
					count+=mi[i];
				for(int j=0;j<m;j++)
					count+=mj[j];
				count+=min*m;
				out.println(count);
				while(mi[0]>0)
				{
					out.println("row "+(1));
					mi[0]--;
				}
				for(int j=0;j<m;j++)
				{
					while(mj[j]>0)
					{
						out.println("col "+(j+1));
						mj[j]--;
					}
				}
				for(int j=0;j<min;j++){for(int i=0;i<m;i++)
				{
					out.println("col "+(i+1));
				}}
				for(int i=1;i<n;i++)
				{
					while(mi[i]>0)
					{
						out.println("row "+(i+1));
						mi[i]--;
					}
				}				
				}
				else
					out.println("-1");
			}
			//---------------------------------
			out.close();
		}
		
		static long comb(long n,long r)
		{
			if(n<r)
				return 0;
			if(n-r < r) r = n-r;
		    if(r == 0) return 1;
		    return ((n*comb(n-1, r-1))/r);
		}
		
		static long modularExpon(long x,long n,long M)
		{
		    long result=1;
		    while(n>0)
		    {
		        if(n % 2 ==1)
		            result=(result * x)%M;
		        x=(x*x)%M;
		        n=n/2;
		    }
		    return result;
		}
		static int IsPandigital(int n)
	    {
	        int digits = 0,temp=n; int count = 0; int tmp = 0;
	        int fr[]=new int[10];
	        for(int i=0;i<10;i++)
	        	fr[i]=0;
	        while(temp>0)
	        {
	        	int a=temp/10;
	        	//System.out.println(temp-a*10);
	        	fr[temp-a*10]++;
	        	temp=temp/10;
	        	digits++;
	        }
	        for(int i=1;i<=digits;i++)
	        {
	        	if(fr[i]==1)
	        	{
	        		tmp=1;
	        	}
	        	else
	        	{
	        		tmp=0;
	        		break;
	        	}
	        }
	        return tmp;
	    }
		
		static int Divisors(int n)
		{
			int sum=0;
		    for (int i=2; i*i<=n; i++)
		    {
		        if (n%i==0)
		        {
		            if (n/i == i)
		                {sum+=i;//System.out.println(sum+" "+i);
		                }
		 
		            else 
		                {sum+=i+(n/i);//System.out.println(sum+" "+i+" "+(n/i));
		                }
		        }
		    }
		    return sum;
		}
		
		static int findmax(int arr[], int n)
	    {
	        int incl = arr[0];
	        int excl = 0;
	        int excl_new;
	        int i;
	 
	        for (i = 1; i < n; i++)
	        {
	            excl_new = (incl > excl) ? incl : excl;
	            incl = excl + arr[i];
	            excl = excl_new;
	        }
	        return ((incl > excl) ? incl : excl);
	    }
		
		static long ce(long x)
		{
			if(x%2!=0)
				return x/2+1;
			return x/2;
		}
		static boolean isSubSequence(String str1, String str2, int m, int n)
		{
		   int j = 0;
		   for (int i=0; i<n&&j<m; i++)
		       if (str1.charAt(j) == str2.charAt(i))
		         j++;
		 
		   return (j==m);
		}
		
		static long fibo(long l) {
	        if (l < 0) {
	            throw new IllegalArgumentException("The fibo value cannot be negative");
	        }
	
	        if (l <= 1) return l;
	
	        long[][] result = {{1, 0}, {0, 1}}; // identity matrix.
	        long[][] fiboM = {{1, 1}, {1, 0}};
	
	        while (l > 0) {
	            if (l%2 == 1) {
	                multMatrix(result, fiboM);
	            }
	            l = l / 2;
	            multMatrix(fiboM, fiboM);
	        }
	
	        return result[1][0];
	    }
	
	    private static void multMatrix(long[][] result, long[][] fiboM) {
	        long a = (result[0][0]%mod * fiboM[0][0]%mod)%mod +  (result[0][1]%mod * fiboM[1][0]%mod)%mod;
	        long b = (result[0][0]%mod * fiboM[0][1]%mod)%mod + ( result[0][1]%mod * fiboM[1][1]%mod)%mod;
	        long c = (result[1][0]%mod * fiboM[0][0]%mod)%mod + ( result[1][1]%mod * fiboM[0][1]%mod)%mod;
	        long d = (result[1][0]%mod * fiboM[0][1]%mod)%mod +  (result[1][1]%mod * fiboM[1][1]%mod)%mod;
	
	        result[0][0] = a;
	        result[0][1] = b;
	        result[1][0] = c;
	        result[1][1] = d;
	    }
	    
	    
		static int[] sieve(int n,int[] arr)
		{
			arr[0]=1;
			arr[1]=1;
			for(int i=2;i*i<=n;i++)
			{
				if(arr[i]==0)
				{
					for(int j=i*2;j<=n;j+=i)
						arr[j]=1;
				}
			}
			return arr;
		}
		
		static int[] spfsieve(int arr[])
		{
			int n=1000000;
			arr[0]=1;
			arr[1]=1;
			for(int i=2;i<=n;i++)
				arr[i]=i;
			for(int i=4;i<=n;i+=2)
				arr[i]=2;
			for(int i=3;i*i<=n;i++)
			{
				if(arr[i]==i)
				{
					for(int j=i*i;j<=n;j+=i)
						if (arr[j]==j)
		                    arr[j] = i;
				}
			}
			return arr;
		}
		
		static boolean isPal(String s)
		{
			for(int i=0, j=s.length()-1;i<=j;i++,j--)
			{
				if(s.charAt(i)!=s.charAt(j)) return false;
			}
			return true;
		}
		public static String rev(String s)
		{
			StringBuilder sb=new StringBuilder(s);
			sb.reverse();
			return sb.toString();
		}
		    
		static long lcm(long a, long b)
		{
			long temp1=a,temp2=b;
		    return ((a * b) / gcd(temp1, temp2));
		}
		
		static long gcd(long a, long b)
		{
		    if (b==0)
		        return a;
		    return gcd(b, a%b);
		}
		static long modulo(long a,long b,long c) {
			long x=1;
			long y=a;
			while(b > 0){
				if(b%2 == 1){
					x=(x*y)%c;
				}
				y = (y*y)%c; // squaring the base
				b /= 2;
			}
			return  x%c;
		}
		public static void debug(Object... o) {
			System.out.println(Arrays.deepToString(o));
		}
		
		/*class SegmentTree 
		{
			
		    ArrayList<Integer> st[]; 
		    SegmentTree(int a[], int n)
		    {
		        int x = (int) (Math.ceil(Math.log(n) / Math.log(2)));
		        int max_size = 2 * (int) Math.pow(2, x) - 1;		 
		        st = new ArrayList[max_size];		 
		        constructSTUtil(a, 0, n - 1, 0);
		    }
		    int getMid(int s, int e) {
		        return s + (e - s) / 2;
		    }
		    int getSumUtil(int ss, int se, int qs, int qe, int si)
		    {
		        if (qs <= ss && qe >= se)
		            return st[si];
		        if (se < qs || ss > qe)
		            return 0;
		        int mid = getMid(ss, se);
		        return getSumUtil(ss, mid, qs, qe, 2 * si + 1) +
		                getSumUtil(mid + 1, se, qs, qe, 2 * si + 2);
		    }
		    /*void updateValueUtil(int ss, int se, int i, int diff, int si)
		    {
		        if (i < ss || i > se)
		            return;
		        st[si] = st[si] + diff;
		        if (se != ss) {
		            int mid = getMid(ss, se);
		            updateValueUtil(ss, mid, i, diff, 2 * si + 1);
		            updateValueUtil(mid + 1, se, i, diff, 2 * si + 2);
		        }
		    }
		    void updateValue(int arr[], int n, int i, int new_val)
		    {
		        if (i < 0 || i > n - 1) {
		            System.out.println("Invalid Input");
		            return;
		        }
		        int diff = new_val - arr[i];
		        arr[i] = new_val;
		        updateValueUtil(0, n - 1, i, diff, 0);
		    }
		    int getSum(int n, int qs, int qe)
		    {
		        if (qs < 0 || qe > n - 1 || qs > qe) {
		            System.out.println("Invalid Input");
		            return -1;
		        }
		        return getSumUtil(0, n - 1, qs, qe, 0);
		    }
		    ArrayList<Integer> constructSTUtil(int a[], int ss, int se, int si)
		    {
		        if (ss == se) {
		        	st[si]=new ArrayList<Integer>();
		        	int temp=a[ss];
		        	st[si].add(arr[temp]);
		        	while(temp!=1)
		        	{
		        		temp/=arr[temp];
		        		st[si].add(arr[temp]);
		        	}
		            return st[si];
		        }
		        int mid = getMid(ss, se);
		        st[si]=new ArrayList<Integer>();
		        ArrayList<Integer> temp1= constructSTUtil(a, ss, mid, si * 2 + 1) ;
		        ArrayList<Integer> temp2= constructSTUtil(a, mid + 1, se, si * 2 + 2);
		        int ts1=0,ts2=0;
		        while(ts1<temp1.size() && ts2<temp2.size())
		        {
		        	if(temp1.get(ts1)<=temp2.get(ts2))
		        	{
		        		st[si].add(temp1.get(ts1));
		        	}
		        }
		        return st[si];
		    }
		}
		*/
		static class Pair {
			int x;
			int y;
			/*Pair(int xx,int yy,int zz){
				x=xx;
				y=yy;
				z=zz;
			}*/
			public int getx()
			{
				return x;
			}
			public int gety()
			{
				return y;
			}
			public void setx(int xx)
			{
				x=xx;
			}
			public void sety(int yy)
			{
				y=yy;
			}
		}
		
		public final static Comparator<Pair> ORIGINAL = new Comparator<Pair>()
	    {
		public int compare(Pair p1,Pair p2)
		{
			if(p1.getx()<p2.getx())
				return -1;
			else //if(p1.getx()>p2.getx() || p1.gety()>p2.gety() || p1.getz()>p2.getz())
				return 1;
			/*else
			{
				if(p1.gety()<p2.gety())
					return -1;
				else if(p1.gety()>p2.gety())
					return 1;
				else
				{
					if(p1.getz()<p2.getz())
						return -1;
					else if(p1.getz()>p2.getz())
						return 1;
				}
			}*/
			//return 0;
		}
	    };
		
		static class InputReader {
			public BufferedReader reader;
			public StringTokenizer tokenizer;
	
			public InputReader(InputStream inputstream) {
				reader = new BufferedReader(new InputStreamReader(inputstream));
				tokenizer = null;
			}
	
			public String nextLine(){
				String fullLine=null;
				while (tokenizer == null || !tokenizer.hasMoreTokens()) {
					try {
						fullLine=reader.readLine();
					} catch (IOException e) {
						throw new RuntimeException(e);
					}
					return fullLine;
				}
				return fullLine;
			}
			public String next() {
				while (tokenizer == null || !tokenizer.hasMoreTokens()) {
					try {
						tokenizer = new StringTokenizer(reader.readLine());
					} catch (IOException e) {
						throw new RuntimeException(e);
					}
				}
				return tokenizer.nextToken();
			}
			public long nextLong() {
				return Long.parseLong(next());
			}
			public int nextInt() {
				return Integer.parseInt(next());
			}
		}
		
	} 