#include <bits/stdc++.h>
using namespace std;
const int N = 100010;
const int inf = 0X3f3f3f3f;
const long long INF = 0x3f3f3f3f3f3f3f3f;
const double eps = 1e-6;
const double pi = acos(-1.0);
const int mod = 1000000007;
int n, m;
int a[100][100];
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) scanf("%d", &a[i][j]);
  }
  vector<pair<int, int> > ans;
  for (int i = 1; i < n; i++) {
    for (int j = 1; j < m; j++) {
      if (a[i][j] * a[i][j + 1] * a[i + 1][j] * a[i + 1][j + 1] > 0) {
        a[i][j] = a[i][j + 1] = a[i + 1][j] = a[i + 1][j + 1] = 2;
        ans.push_back({i, j});
      }
    }
  }
  bool ok = true;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      if (a[i][j] == 1) {
        ok = false;
        break;
      }
    }
  }
  if (!ok)
    puts("-1");
  else {
    printf("%d\n", (int)ans.size());
    for (int i = 0; i < (int)ans.size(); i++) {
      printf("%d %d\n", ans[i].first, ans[i].second);
    }
  }
  return 0;
}
