#include <bits/stdc++.h>   using namespace std;   const long long N = 1000006, MOD = 1e9 + 7, INF = 1e16;   long long a[N], b, n, m, k, g[105][105], q, x, ans, Ans, pre[N], l, r;   string s;   pair<int, int> p[N];   int main() {     ios_base::sync_with_stdio(false), cin.tie(0);     cin >> n >> m;     for (int i = 1; i <= n; i++)       for (int j = 1; j <= m; j++) cin >> g[i][j];     for (int i = 1; i <= n; i++)       for (int j = 1; j <= m; j++)         if (g[i][j] < 1) x = 1;     while (!x) {       Ans++;       q += min(n, m);       for (int i = 1; i <= n; i++)         for (int j = 1; j <= m; j++) {           g[i][j]--;           if (g[i][j] < 1) x = 1;         }     }     ans = 0;     x = 0;     for (int i = 1; i <= n; i++)       if (!g[i][1]) x = 1;     while (!x) {       ans++, r++;       for (int i = 1; i <= n; i++) {         g[i][1]--;         if (!g[i][1]) x = 1;       }     }     x = 0;     for (int i = 1; i <= m; i++)       if (!g[1][i]) x = 1;     while (!x) {       ans++, l++;       for (int i = 1; i <= m; i++) {         g[1][i]--;         if (!g[1][i]) x = 1;       }     }     for (int i = 1; i <= n; i++)       for (int j = 1; j <= m; j++)         if (g[i][j] != g[1][j] + g[i][1]) {           cout << -1;           return 0;         }     for (int i = 1; i <= n; i++) ans += g[i][1];     for (int i = 2; i <= m; i++) ans += g[1][i];     cout << ans + q << endl;     for (int i = 1; i <= l; i++)       cout <<  row             <<     << 1 << endl;     for (int i = 1; i <= r; i++)       cout <<  col             <<     << 1 << endl;     for (int i = 1; i <= n; i++)       for (int u = 1; u <= g[i][1]; u++)         cout <<  row               <<     << i << endl;     for (int i = 1; i <= m; i++)       for (int u = 1; u <= g[1][i]; u++)         cout <<  col               <<     << i << endl;     if (n < m)       s =  row ;     else       s =  col ;     for (int i = 0; i < min(n, m) * Ans; i++)       cout << s <<     << i % min(n, m) + 1 << endl;   }   