#include <bits/stdc++.h>
using namespace std;
int n, m, a[105][105], b[105][105];
vector<pair<int, int>> p;
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n >> m;
  for (int i = (1); i <= (n); i++)
    for (int j = (1); j <= (m); j++) cin >> a[i][j];
  for (int i = (1); i <= (n - 1); i++)
    for (int j = (1); j <= (m - 1); j++)
      if (a[i][j] && a[i + 1][j] && a[i][j + 1] && a[i + 1][j + 1])
        b[i][j] = b[i][j + 1] = b[i + 1][j] = b[i + 1][j + 1] = 1;
  for (int i = (1); i <= (n); i++)
    for (int j = (1); j <= (m); j++)
      if (a[i][j] != b[i][j]) return cout << -1, 0;
  for (int i = (1); i <= (n - 1); i++)
    for (int j = (1); j <= (m - 1); j++)
      if (a[i][j] && a[i + 1][j] && a[i][j + 1] && a[i + 1][j + 1])
        p.push_back(make_pair(i, j));
  cout << p.size() << '\n';
  for (auto v : p) cout << v.first << " " << v.second << '\n';
}
