#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
const int maxn = 1e6 + 7;
int read() {
  int x = 0;
  int zf = 1;
  char ch = ' ';
  while (ch != '-' && (ch < '0' || ch > '9')) ch = getchar();
  if (ch == '-') zf = -1, ch = getchar();
  while (ch >= '0' && ch <= '9') x = x * 10 + ch - '0', ch = getchar();
  return x * zf;
}
long long a[111][111], b[111][111];
bool cmp(int a, int b) { return a > b; }
long long power(long long a, long long b, long long mod) {
  long long res = 1;
  while (b) {
    if (b & 1) res = res * a % mod;
    b >>= 1;
    a = a * a % mod;
  }
  return res;
}
long long inv(int x, int mod) { return power(x, mod - 2, mod); }
long long jud[111][111] = {0};
int main(int argc, char* argv[]) {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, m, i, j;
  cin >> n >> m;
  for (i = 0; i < n; i++) {
    for (j = 0; j < m; j++) {
      cin >> a[i][j];
    }
  }
  int cnt = 0;
  for (i = 0; i < n - 1; i++) {
    for (j = 0; j < m - 1; j++) {
      if (a[i][j] && a[i][j + 1] && a[i + 1][j] && a[i + 1][j + 1])
        jud[i][j]++, cnt++;
    }
  }
  for (i = 0; i < n - 1; i++) {
    for (j = 0; j < m - 1; j++) {
      if (jud[i][j]) b[i][j] = b[i][j + 1] = b[i + 1][j] = b[i + 1][j + 1] = 1;
    }
  }
  for (i = 0; i < n; i++) {
    for (j = 0; j < m; j++) {
      if (a[i][j] != b[i][j]) {
        cout << -1;
        return 0;
      }
    }
  }
  cout << cnt << endl;
  for (i = 0; i < n - 1; i++) {
    for (j = 0; j < m - 1; j++) {
      if (jud[i][j]) cout << i + 1 << " " << j + 1 << endl;
    }
  }
  return 0;
}
