#include #include using namespace std; int mA[20][20]; int mB[20][20]; int main() { int m, n; cin >> m >> n; while(m!=0 && n!=0) { for(int i=0; i> mA[i][j]; for(int i=0; i> mB[i][j]; list ansx, ansy; for(int x=0; xmA[x][y]) { opt=false; //cout << "broke: by A " << i << endl; break; } for(int i=0; imB[x][y]) { opt=false; //cout << "broke: by B " << i << endl; break; } if(opt) { ansx.push_back(x+1); ansy.push_back(y+1); } } cout << ansx.size() << endl; for(list::iterator it=ansx.begin(), it2=ansy.begin(); it!=ansx.end(); it++, it2++) cout << *it << " " << *it2 << endl; cin >> m >> n; } }