#include <bits/stdc++.h>
using namespace std;
#define MOD 998244353
int T, id, n, m, c, f;  //datasets, lines, columns,
bool a[1010][1010];
int main() {
    freopen("plant1.in", "r", stdin);
    // freopen("plant.out", "w", stdout);
    cin >> T >> id;
    while(T--) {
        cin >> n >> m >> c >> f;
        for(int i=1; i<=n; ++i) {
            for(int j=1; j<=m; j++) {
                char c=getchar();
                if(c=='1') {
                    a[i][j]=true;
                    cout << "got a hole at " << i << " " << j << endl;
                } else if(c=='0') {
                    continue;
                } else {    //filter out unknown characters: minus j, continue to get a char again
                    --j;
                    continue;
                }
            }
            getchar();//filter '\n'
        }
        //for debugging purpose only start
        // for(int i=1; i<=n; ++i) {
            // for(int j=1; j<=m; j++) {
                // putchar(a[i][j]);
                // cout << a[i][j];
                // cout << "why the f*** isn't this outputting anything?" << endl;
            // }
            // cout << endl;
        // }
        //for debugging purpose only end
    }
    return 0;
}