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:
/*
 * 
 * @Author  Ajudiya_13(Bhargav Girdharbhai Ajudiya)
 * Dhirubhai Ambani Institute of Information And Communication Technology 
 * 
 */


import java.util.*;
import java.io.*;
import java.lang.*;

public class Code183
{
	
	
	static class InputReader {
		 
		private final InputStream stream;
		private final byte[] buf = new byte[8192];
		private int curChar, snumChars;
		private SpaceCharFilter filter;
 
		public InputReader(InputStream stream) {
			this.stream = stream;
		}
 
		public int snext() {
			if (snumChars == -1)
				throw new InputMismatchException();
			if (curChar >= snumChars) {
				curChar = 0;
				try {
					snumChars = stream.read(buf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (snumChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}
 
		public int nextInt() {
			int c = snext();
			while (isSpaceChar(c)) {
				c = snext();
			}
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = snext();
			}
			int res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = snext();
			} while (!isSpaceChar(c));
			return res * sgn;
		}
 
		public long nextLong() {
			int c = snext();
			while (isSpaceChar(c)) {
				c = snext();
			}
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = snext();
			}
			long res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = snext();
			} while (!isSpaceChar(c));
			return res * sgn;
		}
 
		public int[] nextIntArray(int n) {
			int a[] = new int[n];
			for (int i = 0; i < n; i++) {
				a[i] = nextInt();
			}
			return a;
		}
 
		public String readString() {
			int c = snext();
			while (isSpaceChar(c)) {
				c = snext();
			}
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = snext();
			} while (!isSpaceChar(c));
			return res.toString();
		}
 
		public String nextLine() {
			int c = snext();
			while (isSpaceChar(c))
				c = snext();
			StringBuilder res = new StringBuilder();
			do {
				res.appendCodePoint(c);
				c = snext();
			} while (!isEndOfLine(c));
			return res.toString();
		}
 
		public boolean isSpaceChar(int c) {
			if (filter != null)
				return filter.isSpaceChar(c);
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}
 
		private boolean isEndOfLine(int c) {
			return c == '\n' || c == '\r' || c == -1;
		}
 
		public interface SpaceCharFilter {
			public boolean isSpaceChar(int ch);
		}
	}
	
	public static long mod = 1000000007;
	public static int d;
	public static int p;
	public static int q;
	
	public static int[] suffle(int[] a,Random gen)
	{
		int n = a.length;
		for(int i=0;i<n;i++)
		{
			int ind = gen.nextInt(n-i)+i;
			int temp = a[ind];
			a[ind] = a[i];
			a[i] = temp;
		}
		return a;
	}
	
	public static void swap(int a, int b){
		int temp = a;
		a = b;
		b = temp;
	}
	
	public static ArrayList<Integer> primeFactorization(int n)
	{
		ArrayList<Integer> a =new ArrayList<Integer>();
		for(int i=2;i*i<=n;i++)
		{
			while(n%i==0)
			{
				a.add(i);
				n/=i;
			}
		}
		if(n!=1)
			a.add(n);
		return a;
	}
	
	public static void sieve(boolean[] isPrime,int n)
	{
		for(int i=1;i<n;i++)
			isPrime[i] = true;
		
		isPrime[0] = false;
		isPrime[1] = false;
		
		for(int i=2;i*i<n;i++)
		{
			if(isPrime[i] == true)
			{
				for(int j=(2*i);j<n;j+=i)
					isPrime[j] = false;
			}
		}
	}
	
	public static int GCD(int a,int b)
	{
		if(b==0)
			return a;
		else
			return GCD(b,a%b);
	}
	
	public static long GCD(long a,long b)
	{
		if(b==0)
			return a;
		else
			return GCD(b,a%b);
	}
	
	public static void extendedEuclid(int A,int B)
	{
		if(B==0)
		{
			d = A;
			p = 1 ;
			q = 0;
		}
		else
		{
			extendedEuclid(B, A%B);
			int temp = p;
			p = q;
			q = temp - (A/B)*q;
		}
	}
	
	public static long LCM(long a,long b)
	{
		return (a*b)/GCD(a,b);
	}
	
	public static int LCM(int a,int b)
	{
		return (a*b)/GCD(a,b);
	}
	
	public static int binaryExponentiation(int x,int n)
	{
	    int result=1;
	    while(n>0)
	    {
	        if(n % 2 ==1)
	            result=result * x;
	        x=x*x;
	        n=n/2;
	    }
	    return result;
	}
	
	public static long binaryExponentiation(long x,long n)
	{
	    long result=1;
	    while(n>0)
	    {
	        if(n % 2 ==1)
	            result=result * x;
	        x=x*x;
	        n=n/2;
	    }
	    return result;
	}
	
	public static int modularExponentiation(int x,int n,int M)
	{
	    int result=1;
	    while(n>0)
	    {
	        if(n % 2 ==1)
	            result=(result * x)%M;
	        x=(x*x)%M;
	        n=n/2;
	    }
	    return result;
	}
	
	public static long modularExponentiation(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;
	}
	
	public static int modInverse(int A,int M)
	{
	    return modularExponentiation(A,M-2,M);
	}
	
	public static long modInverse(long A,long M)
	{
	    return modularExponentiation(A,M-2,M);
	}
	
	public static boolean isPrime(int n)
	{
	    
	    if (n <= 1)  return false;
	    if (n <= 3)  return true;
	    
	    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;
	}
	
	static class pair implements Comparable<pair>
	{
		Integer x, y;
		pair(int x,int y)
		{
			this.x=x;
			this.y=y;
		}
		
		public int compareTo(pair o) {
			int result = x.compareTo(o.x);
			if(result==0)
				result = y.compareTo(o.y);
			
			return result;
		}  
	}
	
	public static void main(String[] args)
	{
		InputReader in = new InputReader(System.in);
		PrintWriter pw = new PrintWriter(System.out);
		
		int n = in.nextInt();
		int m = in.nextInt();
		
		int[] rowMin = new int[n];
		int[] columnMin = new int[m];
		int[][] a = new int[n][m];
		Arrays.fill(rowMin, Integer.MAX_VALUE);
		Arrays.fill(columnMin, Integer.MAX_VALUE);
		boolean flag = true;
		ArrayList<Integer> rowAns = new ArrayList<>();
		ArrayList<Integer> columnAns = new ArrayList<Integer>();
		
 		for(int i=0;i<n;i++)
		{
			for(int j=0;j<m;j++)
			{
				a[i][j] = in.nextInt();
				rowMin[i] = Math.min(rowMin[i], a[i][j]);
				columnMin[j] = Math.min(columnMin[j],a[i][j]);
			}
		}
 		
 		if(n<m)
 		{
 			for(int i=0;i<n;i++)
 			{
 				if(rowMin[i]!=0)
 				{
 					for(int j=0;j<rowMin[i];j++)
 						rowAns.add(i+1);
 				}
 			}
 			
 			for(int j=0;j<m;j++)
 			{
 				int diff =a[0][j] - rowMin[0];
 				if(diff>=0)
 				{
 					for(int i=1;i<n;i++)
 					{
 						int d = a[i][j] - rowMin[i];
 						if(d!=diff)
 							flag = false;
 					}
 					
 					if(flag)
 					{
 						for(int i=0;i<diff;i++)
 							columnAns.add(j+1);
 					}
 				}
 				else
 					flag = false;
 			}
 		}
 		
 		else if(n>m)
 		{
 			for(int j=0;j<m;j++)
 			{
 				if(columnMin[j]!=0)
 				{
 					for(int i=0;i<columnMin[j];i++)
 						columnAns.add(j+1);
 				}
 			}
 			
 			for(int i=0;i<n;i++)
 			{
 				int diff =a[i][0] - columnMin[0];
 				if(diff>=0)
 				{
 					for(int j=1;j<m;j++)
 					{
 						int d = a[i][j] - columnMin[j];
 						if(d!=diff)
 							flag = false;
 					}
 					
 					if(flag)
 					{
 						for(int j=0;j<diff;j++)
 							rowAns.add(i+1);
 					}
 				}
 				else
 					flag = false;
 			}
 		}
 		
 		else
 		{
 			boolean flag1 = true;
 			boolean flag2 = true;
 			ArrayList<Integer> t1rA = new ArrayList<Integer>();
 			ArrayList<Integer> t1cA = new ArrayList<Integer>();
 			
 			ArrayList<Integer> t2rA = new ArrayList<Integer>();
 			ArrayList<Integer> t2cA = new ArrayList<Integer>();
 			
 			
 			for(int i=0;i<n;i++)
 			{
 				if(rowMin[i]!=0)
 				{
 					for(int j=0;j<rowMin[i];j++)
 						t1rA.add(i+1);
 				}
 			}
 			
 			for(int j=0;j<m;j++)
 			{
 				int diff =a[0][j] - rowMin[0];
 				if(diff>=0)
 				{
 					for(int i=1;i<n;i++)
 					{
 						int d = a[i][j] - rowMin[i];
 						if(d!=diff)
 							flag1 = false;
 					}
 					
 					if(flag)
 					{
 						for(int i=0;i<diff;i++)
 							t1cA.add(j+1);
 					}
 				}
 				else
 					flag1 = false;
 			}
 			
 			for(int j=0;j<m;j++)
 			{
 				if(columnMin[j]!=0)
 				{
 					for(int i=0;i<columnMin[j];i++)
 						t2cA.add(j+1);
 				}
 			}
 			
 			for(int i=0;i<n;i++)
 			{
 				int diff =a[i][0] - columnMin[0];
 				if(diff>=0)
 				{
 					for(int j=1;j<m;j++)
 					{
 						int d = a[i][j] - columnMin[j];
 						if(d!=diff)
 							flag2 = false;
 					}
 					
 					if(flag)
 					{
 						for(int j=0;j<diff;j++)
 							t2rA.add(i+1);
 					}
 				}
 				else
 					flag2 = false;
 			}
 			
 			if(flag1 && !flag2)
 			{
 				rowAns = t1rA;
 				columnAns = t1cA;
 			}
 			
 			else if(!flag1 && flag2)
 			{
 				rowAns = t2rA;
 				columnAns = t2cA;
 			}
 			
 			else if(flag1 && flag2)
 			{
 				if(t1cA.size()+t1rA.size()>=t2cA.size()+t2rA.size())
 				{
 					rowAns = t1rA;
 	 				columnAns = t1cA;
 				}
 				else
 				{
 					rowAns = t2rA;
 	 				columnAns = t2cA;
 				}
 			}
 			else
 				flag = false;
  		}
 		
 		if(flag)
 		{
 			pw.println(rowAns.size()+columnAns.size());
 			{
 				for(int i=0;i<rowAns.size();i++)
 					pw.println("row " + rowAns.get(i));
 				
 				for(int i=0;i<columnAns.size();i++)
 					pw.println("col " + columnAns.get(i));	
 			}
 		}
 		else
 			pw.println("-1");
		pw.flush();
		pw.close();
	}
}