#include<bits/stdc++.h> usingnamespace std; int n,m; bool a[55][55],b[55][55]; vector<pair<int,int> > ans; intmain(){ scanf("%d%d",&n,&m); for (int i=1;i<=n;i++) for (int j=1;j<=m;j++)scanf("%d",&a[i][j]); for (int i=1;i<n;i++) for (int j=1;j<m;j++)if(a[i][j]&&a[i+1][j]&&a[i][j+1]&&a[i+1][j+1])ans.push_back(make_pair(i,j)),b[i][j]=b[i+1][j]=b[i][j+1]=b[i+1][j+1]=1;//如果a[i][j]、a[i][j+1]、a[i+1][j]和a[i+1][j+1]都为1的话我们才能在(i,j)操作一次,更新b for (int i=1;i<=n;i++) for (int j=1;j<=m;j++)if(b[i][j]^a[i][j])return !printf("-1");//如果a和b有不一样的地方那肯定就是无解了 printf("%d\n",ans.size()); for (vector<pair<int,int> >::iterator it=ans.begin();it!=ans.end();it++)printf("%d %d\n",it->first,it->second);//输出 }