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.BufferedWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStreamWriter;
import java.util.ArrayList;
import java.util.List;

public class MContest {
	private static int sNext;
	private static final int EOF = -1;
	private static InputStream sInput = System.in;
	private static final String LINE_SEPARATOR = System.getProperty("line.separator");
	private static BufferedWriter sOutput = new BufferedWriter(new OutputStreamWriter(System.out));

	public MContest() throws Exception {
		sNext = sInput.read();
		solve();
		sInput.close();
		sOutput.close();
	}

	public static void main(String[] args) {
		try {
			new MContest();
		} catch (Exception e) {
			try {
				sInput.close();
				sOutput.close();
			} catch (IOException ioe) {
				ioe.printStackTrace();
			}
			e.printStackTrace();
		}
	}

	private boolean digit(int cp) {
		return cp >= '0' && cp <= '9';
	}

	private boolean whitespace(int cp) {
		return cp == ' ' || cp == '\t' || cp == '\r' || cp == '\n';
	}

	private boolean lineSeparator(int cp) {
		return cp == '\n' || cp == '\r';
	}

	private boolean wordSeparator(int cp) {
		return cp == ' ' || cp == '\t';
	}

	private Integer ni() throws IOException {
		while (whitespace(sNext)) sNext = sInput.read();
		int num = 0, sign = (sNext == '-') ? '-' : '+';
		if (sign == '-') sNext = sInput.read();
		if (!digit(sNext)) return null;
		while (true) {
			num = (num << 1) + (num << 3) + sNext - '0';
			if (!digit(sNext = sInput.read())) break;
		}
		return (sign == '-') ? -num : num;
	}

	private int[] nis() throws IOException {
		while (whitespace(sNext)) sNext = sInput.read();
		List<Integer> list = new ArrayList<>();
		while (!lineSeparator(sNext)) {
			Integer num = ni();
			if (num == null) break;
			list.add(num);
			while (wordSeparator(sNext)) sNext = sInput.read();
		}
		int n = list.size();
		if (n < 1) return null;
		int a[] = new int[n];
		for (int i = 0; i < n; ++i)
			a[i] = list.get(i);
		return a;
	}

	private int[] nis(int n) throws IOException {
		int a[] = new int[n];
		for (int i = 0; i < n; ++i)
			a[i] = ni();
		return a;
	}

	private int[][] nis(int r, int c) throws IOException {
		int a[][] = new int[r][c];
		for (int i = 0; i < r; ++i)
			a[i] = nis(c);
		return a;
	}

	private Long nl() throws IOException {
		while (whitespace(sNext)) sNext = sInput.read();
		long num = 0, sign = (sNext == '-') ? '-' : '+';
		if (sign == '-') sNext = sInput.read();
		if (!digit(sNext)) return null;
		while (true) {
			num = (num << 1) + (num << 3) + sNext - '0';
			if (!digit(sNext = sInput.read())) break;
		}
		return (sign == '-') ? -num : num;
	}

	private long[] nls() throws IOException {
		while (whitespace(sNext)) sNext = sInput.read();
		List<Long> list = new ArrayList<>();
		while (!lineSeparator(sNext)) {
			Long num = nl();
			if (num == null) break;
			list.add(num);
			while (wordSeparator(sNext)) sNext = sInput.read();
		}
		int n = list.size();
		if (n < 1) return null;
		long a[] = new long[n];
		for (int i = 0; i < n; ++i)
			a[i] = list.get(i);
		return a;
	}

	private long[] nls(int n) throws IOException {
		long a[] = new long[n];
		for (int i = 0; i < n; ++i)
			a[i] = nl();
		return a;
	}

	private long[][] nls(int r, int c) throws IOException {
		long a[][] = new long[r][c];
		for (int i = 0; i < r; ++i)
			a[i] = nls(c);
		return a;
	}

	private Double nd() throws IOException {
		double first = ni(), second;
		if (sNext != '.') return first;
		int res = 0, cnt = 0;
		while (true) {
			if (!digit(sNext = sInput.read())) break;
			cnt++;
			res = (res << 1) + (res << 3) + sNext - '0';
		}
		second = res * StrictMath.pow(10, -cnt);
		return (first < 0.0) ? first - second : first + second;
	}

	private double[] nds() throws IOException {
		List<Double> list = new ArrayList<>();
		while (!lineSeparator(sNext)) {
			Double num = nd();
			if (num == null) break;
			list.add(num);
			while (wordSeparator(sNext)) sNext = sInput.read();
		}
		int n = list.size();
		if (n < 1) return null;
		double a[] = new double[n];
		for (int i = 0; i < n; ++i)
			a[i] = list.get(i);
		return a;
	}

	private double[] nds(int n) throws IOException {
		double a[] = new double[n];
		for (int i = 0; i < n; ++i)
			a[i] = nd();
		return a;
	}

	private double[][] nds(int r, int c) throws IOException {
		double a[][] = new double[r][c];
		for (int i = 0; i < r; ++i)
			a[i] = nds(c);
		return a;
	}

	private String ns() throws IOException {
		while (whitespace(sNext)) sNext = sInput.read();
		if (sNext == EOF) return null;
		StringBuilder sb = new StringBuilder();
		while (true) {
			sb.append((char) sNext);
			if ((sNext = sInput.read()) == EOF || whitespace(sNext)) break;
		}
		return sb.toString();
	}

	private String[] nss() throws IOException {
		List<String> list = new ArrayList<>();
		while (!lineSeparator(sNext)) {
			String str = ns();
			if (str == null) break;
			list.add(str);
			while (wordSeparator(sNext)) sNext = sInput.read();
		}
		int n = list.size();
		if (n < 1) return null;
		String a[] = new String[n];
		for (int i = 0; i < n; ++i)
			a[i] = list.get(i);
		return a;
	}

	private String[] nss(int n) throws IOException {
		String a[] = new String[n];
		for (int i = 0; i < n; ++i)
			a[i] = ns();
		return a;
	}

	private String[][] nss(int r, int c) throws IOException {
		String a[][] = new String[r][c];
		for (int i = 0; i < r; ++i)
			a[i] = nss(c);
		return a;
	}

	private StringBuilder line() throws IOException {
		while (whitespace(sNext)) sNext = sInput.read();
		if (sNext == EOF) return null;
		StringBuilder sb = new StringBuilder();
		while (true) {
			sb.append((char) sNext);
			if ((sNext = sInput.read()) == EOF || lineSeparator(sNext)) break;
		}
		return sb;
	}

	private char[] ncs(int n) throws IOException {
		while (whitespace(sNext)) sNext = sInput.read();
		char a[] = new char[n];
		for (int i = 0; i < n; ++i) {
			a[i] = (char) sNext;
			sNext = sInput.read();
		}
		return a;
	}

	private char[][] ncs(int r, int c) throws IOException {
		char a[][] = new char[r][c];
		for (int i = 0; i < r; ++i)
			a[i] = ncs(c);
		return a;
	}

	private void print(char[] cbuf) throws IOException {
		sOutput.write(cbuf, 0, cbuf.length);
	}

	private void println(char[] cbuf) throws IOException {
		sOutput.write(cbuf, 0, cbuf.length);
		sOutput.write(LINE_SEPARATOR);
	}

	private <T> void print(T obj) throws IOException {
		String s = obj + "";
		sOutput.write(s, 0, s.length());
	}

	private <T> void println(T obj) throws IOException {
		String s = obj + LINE_SEPARATOR;
		sOutput.write(s, 0, s.length());
	}

	private <T> void debug(T... args) {
		StringBuilder sb = new StringBuilder();
		try {
			if (args != null) for (T obj : args)
				sb.append(obj + "").append(LINE_SEPARATOR);
			println("\u001B[31m" + sb.toString() + "\u001B[0m");
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	private void debug(String format, Object... args) {
		try {
			if (args != null) format = String.format(format, args);
			println("\u001B[31m" + format + "\u001B[0m");
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	int run(StringBuilder sb, int[][] a, int row, int col, boolean runOnRow) {
		int cnt = 0;
		if(runOnRow) {
			for (int i = 0; i < row; ++i) {
				int min = Integer.MAX_VALUE;
				for (int j = 0; j < col; ++j) {
					if (min > a[i][j]) min = a[i][j];
				}
				if (min > 0) {
					for (int j = 0; j < col; ++j) {
						a[i][j] -= min;
					}
					cnt += min;
					while (min-- > 0) {
						if (sb.length() > 0) sb.append("\n");
						sb.append("row " + (i + 1));
					}
				}
			}
		}else {
			for (int i = 0; i < col; ++i) {
				int min = Integer.MAX_VALUE;
				for (int j = 0; j < row; ++j) {
					if (a[j][i] < min) min = a[j][i];
				}
				if (min > 0) {
					for (int j = 0; j < row; ++j) {
						a[j][i] -= min;
					}
					cnt += min;
					while (min-- > 0) {
						if (sb.length() > 0) sb.append("\n");
						sb.append("col " + (i + 1));
					}
				}
			}
		}
		return cnt;
	}

	private void solve() throws IOException {
		int row = ni(), col = ni(), a[][] = nis(row, col);
		StringBuilder sb = new StringBuilder();
		int cnt = 0;

		boolean runOnRow = row < col;
		cnt += run(sb, a, row, col, runOnRow);
		cnt += run(sb, a, row, col, !runOnRow);

		boolean valid = true;
		for (int i = 0; i < row; ++i) {
			for (int j = 0; j < col; ++j) {
				if (a[i][j] > 0) {
					valid = false;
					break;
				}
			}
			if (!valid) break;
		}
		println(valid ? cnt + "\n" + sb.toString() : -1);
	}
}