#include <bits/stdc++.h>
using namespace std;
int Map[101][101];
int n, m, i, j, cnt, ans[101][10001];
int main() {
  cin >> n >> m;
  for (i = 1; i <= n; i++)
    for (j = 1; j <= m; j++) cin >> Map[i][j];
  for (i = 1; i <= n; i++)
    for (j = 1; j <= m; j++)
      if (Map[i][j]) {
        if (Map[i + 1][j] && Map[i][j + 1] && Map[i + 1][j + 1]) {
          Map[i + 1][j] = Map[i][j + 1] = Map[i + 1][j + 1] = 2;
          ans[1][++cnt] = i;
          ans[2][cnt] = j;
        } else if (Map[i][j] == 1) {
          cout << "-1" << endl;
          return 0;
        }
      }
  cout << cnt << endl;
  for (i = 1; i <= cnt; i++) cout << ans[1][i] << " " << ans[2][i] << endl;
  return 0;
}
