#include <bits/stdc++.h>
using namespace std;
string func(vector<vector<int>> arr, bool tp, int& ans) {
  long long int i, j;
  int r = arr.size();
  int c = arr[0].size();
  vector<int> rowmin(r);
  for (i = 0; i < r; ++i) {
    rowmin[i] = *(min_element(arr[i].begin(), arr[i].end()));
    ans += rowmin[i];
  }
  vector<int> clans(c);
  vector<int> cd(r);
  for (j = 0; j < c; ++j) {
    for (i = 0; i < r; ++i) {
      cd[i] = arr[i][j] - rowmin[i];
    }
    int mx = *max_element(cd.begin(), cd.end());
    int mn = *min_element(cd.begin(), cd.end());
    if (mx != mn) {
      ans = -1;
      return "";
    } else {
      ans += cd[0];
      clans[j] = cd[0];
    }
  }
  string sa = "";
  for (i = 0; i < r; ++i) {
    while (rowmin[i]--) {
      if (tp)
        sa += "col " + to_string(i + 1) + "\n";
      else
        sa += "row " + to_string(i + 1) + "\n";
    }
  }
  for (i = 0; i < c; ++i) {
    while (clans[i]--) {
      if (tp)
        sa += "row " + to_string(i + 1) + "\n";
      else
        sa += "col " + to_string(i + 1) + "\n";
    }
  }
  return sa;
}
int main() {
  long long int n, atl, q, i, l, j, ans = 0;
  int r, c;
  cin >> r >> c;
  vector<vector<int>> arr(r, vector<int>(c));
  vector<vector<int>> tps(c, vector<int>(r));
  for (i = 0; i < r; ++i) {
    for (j = 0; j < c; ++j) {
      cin >> arr[i][j];
      tps[j][i] = arr[i][j];
    }
  }
  int ar = 0, ac = 0;
  string sr = func(arr, 0, ar);
  string sc = func(tps, 1, ac);
  if (ac == -1 || ar == -1) {
    cout << -1 << endl;
    return 0;
  }
  if (ar < ac) {
    cout << ar << endl << sr << endl;
  } else {
    cout << ac << endl << sc << endl;
  }
  return 0;
}
