#include <iostream>
#include <vector>
#include <string>
using namespace std;

#define loop(i,a,b) for(int i=(a);i<int(b);i++)
#define rep(i,b) loop(i,0,b)

using namespace std;

int n;
int m;
int star;
int d;
char bar[100][100];

bool solve() {
    int num[n];
    rep(i,n)num[i] = i+1;
    rep(i,d)rep(j,n-1){
        if(bar[i][j]=='1')swap(num[j],num[j+1]);
    }
    return num[star-1]==m;
}

int main(){
    while(cin>>n && n){
        cin>>m>>star>>d;
        rep(i,d)cin>>bar[i];
        if(solve()){
            cout<<0<<endl;
            goto END;
        }
        rep(i,d){
            rep(j,n-1){
                if((j==0 || bar[i][j-1]=='0') &&
                    bar[i][j]=='0' &&
                    (j+1==n-1 || bar[i][j+1]=='0')){
                    bar[i][j]='1';
                    if(solve()){
                        cout<<i+1<<" "<<j+1<<endl;
                        goto END;
                    }
                    bar[i][j]='0';
                }
            }
        }
        cout<<1<<endl;
    END:;
    }
}