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.text.*;
import java.math.*;
import static java.lang.Integer.*;
import static java.lang.Double.*;
import java.lang.Math.*;

public class karen_and_game {

	public static void main(String[] args) throws Exception {
		new karen_and_game().run();
	}

	public void run() throws Exception {
		FastIO file = new FastIO();
		int n = file.nextInt();
		int m = file.nextInt();
		boolean switcher = false;
		int[][] a = new int[n][m], b = new int[n][m];
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < m; j++) {
				b[i][j] = a[i][j] = file.nextInt();
			}
		}
		ArrayList<Integer> moves = new ArrayList<>();
		boolean works = true;
		while (true) {
			boolean noMoves = true;
			for (int i = 0; i < m; i++) {
				int max = Integer.MAX_VALUE;
				for (int j = 0; j < n; j++) {
					max = Math.min(max, a[j][i]);
				}
				if (max > 0) {
					noMoves = false;
					for (int j = 0; j < n; j++) {
						a[j][i] -= max;
					}
					for (int j = 0; j < max; j++) {
						if (switcher) moves.add(1);
						else moves.add(2);
						moves.add(i + 1);
					}
				}
			}
			for (int i = 0; i < n; i++) {
				int max = Integer.MAX_VALUE;
				for (int j = 0; j < m; j++) {
					max = Math.min(max, a[i][j]);
				}
				if (max > 0) {
					noMoves = false;
					for (int j = 0; j < m; j++) {
						a[i][j] -= max;
					}
					for (int j = 0; j < max; j++) {
						if (switcher) moves.add(2);
						else moves.add(1);
						moves.add(i + 1);
					}
				}
			}
			
			if (noMoves) break;
		}
		for (int i = 0; i < n; i++) for (int j = 0; j < m; j++) if (a[i][j] > 0) works = false;
		//---
		ArrayList<Integer> moves2 = new ArrayList<>();
		boolean works2 = true;
		while (true) {
			boolean noMoves = true;
			for (int i = 0; i < n; i++) {
				int max = Integer.MAX_VALUE;
				for (int j = 0; j < m; j++) {
					max = Math.min(max, b[i][j]);
				}
				if (max > 0) {
					noMoves = false;
					for (int j = 0; j < m; j++) {
						b[i][j] -= max;
					}
					for (int j = 0; j < max; j++) {
						if (switcher) moves2.add(2);
						else moves2.add(1);
						moves2.add(i + 1);
					}
				}
			}
			for (int i = 0; i < m; i++) {
				int max = Integer.MAX_VALUE;
				for (int j = 0; j < n; j++) {
					max = Math.min(max, b[j][i]);
				}
				if (max > 0) {
					noMoves = false;
					for (int j = 0; j < n; j++) {
						b[j][i] -= max;
					}
					for (int j = 0; j < max; j++) {
						if (switcher) moves2.add(1);
						else moves2.add(2);
						moves2.add(i + 1);
					}
				}
			}
			if (noMoves) break;
		}
		for (int i = 0; i < n; i++) for (int j = 0; j < m; j++) if (b[i][j] > 0) works2 = false;
		//---
		if (works && works2) {
			if (moves.size() < moves2.size()) {
				System.out.println(moves.size() / 2);
				for (int i = 0; i < moves.size(); i += 2) {
					System.out.printf("%s %d%n", moves.get(i) == 1 ? "row" : "col", moves.get(i + 1));
				}
			}
			else {
				System.out.println(moves2.size() / 2);
				for (int i = 0; i < moves2.size(); i += 2) {
					System.out.printf("%s %d%n", moves2.get(i) == 1 ? "row" : "col", moves2.get(i + 1));
				}
			}
		}
		else if (works) {
			System.out.println(moves.size() / 2);
			for (int i = 0; i < moves.size(); i += 2) {
				System.out.printf("%s %d%n", moves.get(i) == 1 ? "row" : "col", moves.get(i + 1));
			}
		}
		else if (works2) {
			System.out.println(moves2.size() / 2);
			for (int i = 0; i < moves.size(); i += 2) {
				System.out.printf("%s %d%n", moves2.get(i) == 1 ? "row" : "col", moves2.get(i + 1));
			}
		}
		else {
			System.out.println(-1);
		}
		//System.out.println(moves);
		//System.out.println(moves2);
	}

	public static class FastIO {
		BufferedReader br;
		StringTokenizer st;

		public FastIO() {
			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;
		}
	}

	public static long pow(long n, long p, long mod) {
		if (p == 0)
			return 1;
		if (p == 1)
			return n % mod;
		if (p % 2 == 0) {
			long temp = pow(n, p / 2, mod);
			return (temp * temp) % mod;
		} else {
			long temp = pow(n, (p - 1) / 2, mod);
			temp = (temp * temp) % mod;
			return (temp * n) % mod;

		}
	}

	public static long pow(long n, long p) {
		if (p == 0)
			return 1;
		if (p == 1)
			return n;
		if (p % 2 == 0) {
			long temp = pow(n, p / 2);
			return (temp * temp);
		} else {
			long temp = pow(n, (p - 1) / 2);
			temp = (temp * temp);
			return (temp * n);

		}
	}

	public static long gcd(long x, long y) {
		if (x == 0)
			return y;
		else
			return gcd(y % x, x);
	}

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