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.io.DataInputStream;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.InputMismatchException;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.PriorityQueue;
import java.util.Queue;
import java.util.Random;
import java.util.Scanner;
import java.util.Stack;
import java.util.StringTokenizer;
import java.util.TreeMap;
import java.util.TreeSet;


import java.util.BitSet;

public class contest {
	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 mod = 1000000000 + 7;
	private static int MAX=1000001;
	private static int block;
	private static void soln(){
		/*int n=nextInt();
		int b=nextInt();
		LinkedList[] arr=new LinkedList[n];
		int[] val=new int[n];
		for(int i=0;i<n;i++){
			arr[i]=new LinkedList<>();
			String[] s=nextLine().split(" ");
			if(s.length==2){
				val[i]=nextInt();
				val[i]-=nextInt();
			}else{
				val[i]=nextInt();
				val[i]-=nextInt();
				arr[i].add(nextInt()-1);
			}
		}*/
		int n=nextInt();
		int m=nextInt();
		int sum1=Integer.MAX_VALUE;
		int[][] arr=new int[n][m];
		int[] rowmin=new int[n];
		int[] colmin=new int[m];
		for(int i=0;i<n;i++){
			int min=Integer.MAX_VALUE;
			for(int j=0;j<m;j++){
				arr[i][j]=nextInt();
				min=Math.min(min,arr[i][j]);
			}
			rowmin[i]=min;
		}
		boolean f=false;
		int[] row=null;
		int[] col=null;
		for(int k=0;k<=arr[0][0];k++){
			int[] tr=new int[n];
			Arrays.fill(tr,-1);
			int[] cl=new int[m];
			Arrays.fill(cl,-1);
			cl[0]=k;
			int i=0;
			for(i=0;i<n;i++){
				boolean f1=false;
				for(int j=0;j<m;j++){
					if(cl[j]!=-1 && tr[i]!=-1){
						int temp=cl[j]+tr[i];
						if(temp!=arr[i][j]){
							f1=true;
							break;
						}
					}else if(cl[j]==-1){
						int temp=arr[i][j]-tr[i];
						if(temp<0){
							f1=true;
							break;
						}
						cl[j]=temp;
					}else if(tr[i]==-1){
						int temp=arr[i][j]-cl[j];
						if(temp<0){
							f1=true;
							break;
						}
						tr[i]=temp;
					}
				}
				if(f1)
					break;
			}
			if(i==n){
				f=true;
				int sum=0;
				for(int a=0;a<n;a++)
					sum+=tr[a];
				for(int a=0;a<m;a++)
					sum+=cl[a];
				if(sum<sum1){
					sum1=sum;
					row=tr;
					col=cl;
				}
			}
		}
		if(f){
			
			pw.println(sum1);
			for(int i=0;i<n;i++){
				int t=row[i];
				for(int j=1;j<=t;j++)
					pw.println("row"+" "+(i+1));
			}
			for(int i=0;i<m;i++){
				int t=col[i];
				for(int j=1;j<=t;j++)
					pw.println("col"+" "+(i+1));
			}
		}else
			pw.println(-1);
	}
	private static class Pair1 implements Comparable<Pair1>{
		int i;
		int li;
		public Pair1(int a,int b){
			i=a;li=i+b;
		}
		@Override
		public int compareTo(Pair1 o) {
			return (this.li)-(o.li);
		}
	}
	private static void longestPath(boolean[][] graph,int n){
		int pow=(int) Math.pow(2,n);
		boolean[][] dp=new boolean[n][pow];
		//System.out.println(dp[1][1]);
		for(int i=0;i<n;i++)
			dp[i][(int) Math.pow(2,i)]=true;
		for(int i=0;i<pow;i++){
			for(int j=0;j<n;j++){
				int pow1=(int) Math.pow(2,j);
				int bit=(i>>j)&1;
				//System.out.println(i+" "+j+" "+bit);
				if(bit!=0){
					//System.out.println(bit);
					for(int k=0;k<n;k++){
						int bit1=(i>>k)&1;
						if(j!=k && bit1!=0 && graph[k][j]){
							if(dp[k][i^pow1]){
								dp[j][i]=true;
								break;
							}
						}
					}
				}
			}
		}
		int cnt=Integer.MIN_VALUE;
		int ind=-1;
		for(int i=pow-1;i>=0;i--){
			int cnt1=0;
			for(int j=0;j<n;j++){
				int bit=(i>>j)&1;
				if(bit!=0)
					cnt1++;
			}
			if(cnt1>cnt){
				for(int j=n-1;j>=0;j--){
					if(dp[j][i]){
						ind=j;
						cnt=cnt1;
						break;
					}
				}
			}else if(cnt1==cnt){
				for(int j=n-1;j>ind;j--){
					if(dp[j][i]){
						ind=j;
						break;
					}
				}
			}
		}
		pw.println(ind+1);
	}
	private static class DSU{
		int[] parent;
		public DSU(int n){
			parent=new int[n];
			for(int i=0;i<n;i++)
				parent[i]=i;
		}
		int find(int i){
	        while(parent[i] !=i){
	        	parent[i]=parent[parent[i]];
	        	i=parent[i];
	        }
	        return i;
	    }
		void Union(int x, int y){
	        int xset = find(x);
	        int yset = find(y);
	        parent[yset]=yset;
	        parent[xset] = yset;
	    }
	}
	public static class Merge {
	    public static void sort(long inputArr[]) {
	        int length = inputArr.length;
	        doMergeSort(inputArr,0, length - 1);
	    }
	    private static void doMergeSort(long[] arr,int lowerIndex, int higherIndex) {        
	        if (lowerIndex < higherIndex) {
	            int middle = lowerIndex + (higherIndex - lowerIndex) / 2;
	            doMergeSort(arr,lowerIndex, middle);
	            doMergeSort(arr,middle + 1, higherIndex);
	            mergeParts(arr,lowerIndex, middle, higherIndex);
	        }
	    }
	    private static void mergeParts(long[]array,int lowerIndex, int middle, int higherIndex) {
	        long[] temp=new long[higherIndex-lowerIndex+1];
	        for (int i = lowerIndex; i <= higherIndex; i++) {
	            temp[i-lowerIndex] = array[i];
	        }
	        int i = lowerIndex;
	        int j = middle + 1;
	        int k = lowerIndex;
	        while (i <= middle && j <= higherIndex) {
	            if (temp[i-lowerIndex] < temp[j-lowerIndex]) {
	                array[k] = temp[i-lowerIndex];
	                i++;
	            } else {
	                array[k] = temp[j-lowerIndex];
	                j++;
	                //cnt+=(middle+1-i);
	            }
	            k++;
	        }
	        while (i <= middle) {
	            array[k] = temp[i-lowerIndex];
	            k++;
	            i++;
	        }
	        while(j<=higherIndex){
	            array[k]=temp[j-lowerIndex];
	            k++;
	            j++;
	        }
	        /*pw.println(lowerIndex+" "+higherIndex);
	        for(int m=lowerIndex;m<=higherIndex;m++)
	            pw.print(array[m]+" ");
	        pw.println();*/
	    }

	}

	private static class Edge{
		int x;
		int y;
		int i;
		public Edge(int a,int b,int c){
			x=a; y=b;i=c;
		}
	}
	private static long pow(long a, long b, long c) {
		if (b == 0)
			return 1;
		long p = pow(a, b / 2, c);
		p = (p * p) % c;
		return (b % 2 == 0) ? p : (a * p) % c;
	}
	
	private static class Mo implements Comparable<Mo>{
		int l;
		int r;
		int i;
		int val;
		public Mo(int a,int b,int ind,int d) {
			l=a;r=b;i=ind;val=d;
		}
		@Override
		public int compareTo(Mo arg0) {
			int b1=this.l/block;
			int b2=arg0.l/block;
			return (b1!=b2)?(b1-b2):(this.r-arg0.r);
		}
	}

	private static long gcd(long n, long l) {
		if (l == 0)
			return n;
		return gcd(l, n % l);
	}

	private static long max(long a, long b) {
		if (a > b)
			return a;
		return b;
	}

	private static long min(long a, long b) {
		if (a < b)
			return a;
		return b;
	}

	public static void main(String[] args) throws Exception {
		new Thread(null,new Runnable(){
			@Override
			public void run() {
				/*try {
					InputReader(new FileInputStream("C:\\Users\\hardik\\Desktop\\C-small-1-attempt1.in"));
				} catch (FileNotFoundException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}*/
				/*try {
				InputReader(new FileInputStream("/root/codes/in.txt"));
				} catch (FileNotFoundException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}*/
				InputReader(System.in);
				pw = new PrintWriter(System.out);
				/*try {
					pw=new PrintWriter(new FileOutputStream("C:\\Users\\hardik\\Desktop\\out.txt"));
				} catch (FileNotFoundException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}*/
				/*try {
					pw=new PrintWriter(new FileOutputStream("/root/codes/out.txt"));
				} catch (FileNotFoundException e) {
					// TODO Auto-generated catch block
					e.printStackTrace();
				}*/
				soln();
				pw.close();
			}
		},"1",1<<26).start();
	}

	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[] 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++) {
			System.out.print(arr[i] + " ");
		}
		System.out.println();
		return;
	}

	private static void pArray(long[] arr) {
		for (int i = 0; i < arr.length; i++) {
			System.out.print(arr[i] + " ");
		}
		System.out.println();
		return;
	}

	private static boolean isSpaceChar(int c) {
		if (filter != null)
			return filter.isSpaceChar(c);
		return isWhitespace(c);
	}
	private static char nextChar() {
		int c = read();
		while (isSpaceChar(c))
			c = read();
		char c1=(char)c;
		while(!isSpaceChar(c))
			c=read();
		return c1;
}
	private interface SpaceCharFilter {
		public boolean isSpaceChar(int ch);
	}
}