#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <queue>
#include <stack>
#include <cstring>
#include <cmath>
#include <deque>
#include <set>
#include <climits>

#define rep_(v, f, l) for (int v = (f); v < (l); ++v)
#define rep(v, n) rep_(v, 0, n)

using namespace std;

typedef long long int lint;

template<typename T> inline bool in(T& x){ return cin >> x; }
template<typename T> inline T in(){T x; cin >> x; return x; }

bool solve(const vector<string>& lots, int n, int m, int h, int d)
{
    m--;
    n--;
    h--;
    rep(i, d){
        if (m != 0 && lots[i][m - 1] == '1'){
            m--;
        }
        else if (m != n && lots[i][m] == '1'){
            m++;
        }
    }
    return m == h;
}
bool is_valid(const vector<string>& lots, int n, int d)
{
    n--;
    rep(i, d){
        rep(j, n - 1){
            if (lots[i][j] == '1' && lots[i][j] == lots[i][j + 1]) return false;
        }
    }
    return true;
}

int main()
{
    int n, m, h, d;
    while (in(n), n){
        vector<string> lots;
        in(m);
        in(h);
        in(d);

        rep(i, d) lots.push_back(in<string>());
        
        if (solve(lots, n, m, h, d)){
            puts("0");
            continue;
        }
        rep(i, d){
            rep(j, n - 1){
                if (lots[i][j] == '0'){
                    lots[i][j] = '1';
                    if (is_valid(lots, n, d) && solve(lots, n, m, h, d)){
                        printf("%d %d\n", i + 1, j + 1);
                        goto end;
                    }
                    lots[i][j] = '0';
                }
            }
        }
        puts("1");
end:;
    }
	return (0);
}