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.util.*;
import java.io.*;
import java.math.*;
 public class Q1 {

	static ArrayList<Integer> adj[],adj2[];
	static int color[],cc;
	static long mod=1000000007;
	static TreeSet<Integer> ts;
	static boolean b[],visited[],possible,ans1,ans2;
	static Stack<Integer> s;
	static int totalnodes,colored,minc;
	static int c[];
	static long sum[];
	static HashMap<Integer,Integer> hm;
	public static void main(String[] args) throws IOException {
		
		//Scanner sc=new Scanner(System.in);
		in=new InputReader(System.in);
		out=new PrintWriter(System.out);
		int n=in.nextInt();
		int m=in.nextInt();
		int a[][]=new int[n+1][m+1];
		int b[][]=new int[n+1][m+1];
		for(int i=1;i<=n;i++)
		{
			for(int j=1;j<=m;j++)
			{
				a[i][j]=in.nextInt();
				b[i][j]=a[i][j];
			}
		}
		boolean flag1=true,flag2=true;int cnt1=0,cnt2=0;
		StringBuilder ans1=new StringBuilder("");
		StringBuilder ans2=new StringBuilder("");
		
		for(int i=1;i<=n;i++)
		{
			int min1=Integer.MAX_VALUE;
			for(int j=1;j<=m;j++)
				min1=Math.min(min1,a[i][j]);
		
			for(int j=1;j<=m;j++)
				a[i][j]-=min1;
				
			for(int j=1;j<=min1;j++)
			{	cnt1++;ans1.append("row "+i+"\n");}
		}
		//debug(a);
		
		for(int i=1;i<=m;i++)
		{
			int min2=Integer.MAX_VALUE;
			for(int j=1;j<=n;j++)
				min2=Math.min(min2,a[j][i]);
			
			for(int j=1;j<=n;j++)
				a[j][i]-=min2;
			
			for(int j=1;j<=min2;j++)
			{	cnt1++;ans1.append("col "+i+"\n");}
		}
		for(int i=1;i<=n;i++)
		{
			for(int j=1;j<=m;j++)
			{
				if(a[i][j]!=0)
					flag1=false;
			}
		}
		
		
		
		for(int i=1;i<=m;i++)
		{
			int min2=Integer.MAX_VALUE;
			for(int j=1;j<=n;j++)
				min2=Math.min(min2,b[j][i]);
			
			for(int j=1;j<=n;j++)
				b[j][i]-=min2;
			
			for(int j=1;j<=min2;j++)
			{	cnt2++;ans2.append("col "+i+"\n");}
		}
		for(int i=1;i<=n;i++)
		{
			int min1=Integer.MAX_VALUE;
			for(int j=1;j<=m;j++)
				min1=Math.min(min1,b[i][j]);
			
			for(int j=1;j<=m;j++)
				b[i][j]-=min1;
				
			for(int j=1;j<=min1;j++)
			{	cnt2++;ans2.append("row "+i+"\n");}
		}
		for(int i=1;i<=n;i++)
		{
			for(int j=1;j<=m;j++)
			{
				if(b[i][j]!=0)
					flag2=false;
			}
		}
		if(!flag1 && !flag2 )
		{
			out.println(-1);
			
		}
		else if(cnt1<=cnt2)
		{
			out.println(cnt1);
			out.println(ans1);
		}
		else if(cnt1>cnt2)
		{
			out.println(cnt2);
			out.println(ans2);
		}
		out.close();
		}
	
	static InputReader in;
	static PrintWriter out;
 	static void dfs(int i,int parent)
	{
 		if(color[i]!=cc)
 			ans1= false;
 		for(int j:adj[i])
 		{
 			if(j!=parent)
 			{
 				dfs(j,i);
 			}
 		}
		
	}
	/*public static void seive(long n){
		b = new boolean[(int) (n+1)];
	Arrays.fill(b, true);
	
		for(int i = 2;i*i<=n;i++){
			if(b[i]){
				sum[i]=count[i];
			//	System.out.println(sum[i]+" wf");
				for(int p = 2*i;p<=n;p+=i){
					b[p] = false;
					sum[i]+=count[p];  
					//System.out.println(sum[i]);
				}
			}
		
		}
	}*/
	static class Pair implements Comparable<Pair> {
		int i;
		int j;
		int index;
		public Pair(){
			
		}
		public Pair(int u, int v,int index) {
			this.i = u;
			this.j= v;
			this.index=index;
		}
		public int compareTo(Pair other) {
			
			
				return this.i-other.i;
		}
		
		/*public String toString() {
			return "[u=" + u + ", v=" + v + "]";
		}*/
	}
	static class Node2{
		Node2 left = null;
		Node2 right = null;
		Node2 parent = null;
		int data;
	}
	
	//binaryStree
	static class BinarySearchTree{
		Node2 root = null;
		int height = 0;
		int max = 0;
		int cnt = 1;
		ArrayList<Integer> parent = new ArrayList<>();
		HashMap<Integer, Integer> hm = new HashMap<>();
		public void insert(int x){
			Node2 n = new Node2();
			n.data = x;
			if(root==null){
				root = n;
			}
			else{
				Node2 temp = root,temp2 = null;
				while(temp!=null){
					temp2 = temp;
					if(x>temp.data) temp = temp.right;
					else temp = temp.left;
				}
				if(x>temp2.data) temp2.right = n;
				else temp2.left = n;
				n.parent = temp2;
				parent.add(temp2.data);
			}
		}
		public Node2 getSomething(int x, int y, Node2 n){
			if(n.data==x || n.data==y) return n;
			else if(n.data>x && n.data<y) return n;
			else if(n.data<x && n.data<y) return getSomething(x,y,n.right);
			else return getSomething(x,y,n.left);
		}
		public Node2 search(int x,Node2 n){
			if(x==n.data){
				max = Math.max(max, n.data);
				return n;
			}
			if(x>n.data){
				max = Math.max(max, n.data);
				return search(x,n.right);
			}
			else{
				max = Math.max(max, n.data);
				return search(x,n.left);
			}
		}
		public int getHeight(Node2 n){
			if(n==null) return 0;
			height = 1+ Math.max(getHeight(n.left), getHeight(n.right));
			return height;
		}
	}
public static void debug(Object... o) {
	System.out.println(Arrays.deepToString(o));
}

public static String rev(String s)
{
	StringBuilder sb=new StringBuilder(s);
	sb.reverse();
	return sb.toString();
}

static long lcm(long a, long b)
{
    return a * (b / gcd(a, b));
}

static long gcd(long a, long b)
{
    while (b > 0)
    {
        long temp = b;
        b = a % b; // % is remainder
        a = temp;
    }
    return a;
}

public static long max(long x, long y, long z){
		if(x>=y && x>=z) return x;
		if(y>=x && y>=z) return y;
		return z;
	}
	static int[] sieve(int n,int[] arr)
	{
	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 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) {
	 return nextIntArray(n, 0);
	    }
	    
public int[] nextIntArray(int n, int off) {
	 int[] arr = new int[n + off];
	   for (int i = 0; i < n; i++) {
	    arr[i + off] = nextInt();
	    }
	    return arr;
	    }
	    
public long[] nextLongArray(int n) {
return nextLongArray(n, 0);
	    }
        
	public long[] nextLongArray(int n, int off) {
	 long[] arr = new long[n + off];
	 for (int i = 0; i < n; i++) {
		  arr[i + off] = nextLong();
		 }
 return arr;
	}


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);
}
}
	
}