#include<cstdio>
#include<cstring>
using namespace std;
#define rep(i,j) for(int i=0;i<(j);++i)
#define reps(i,j,k) for(int i=j;i<k;++i)
int n,m,s,d;
char stage[50][20];
int check(){
    int now = m;
    rep(i,d){
        reps(j,1,n-1){
            if(stage[i][j-1] == '1' && stage[i][j] == '1')return 1;
        }
    }
    rep(i,d){
        if(now < n-1 && stage[i][now] == '1')now++;
        else if(now >= 1&&stage[i][now-1] == '1')now--;
    }
    if(now == s)return 0;
}
int main(){
    while(scanf("%d",&n),n){
        scanf("%d%d%d",&m,&s,&d);
        m--,s--;
        rep(i,d)scanf("%s",stage[i]);
        if(check()==0){
            puts("0");
            goto exit;
        }
            rep(i,d){
                rep(j,n-1){
                    if(stage[i][j]=='0'){
                        stage[i][j]='1';
                        if(check()==0){
                            printf("%d %d\n",i+1,j+1);
                            goto exit;
                        }
                        stage[i][j]='0';
                    }
                }
            }
            puts("1");
        exit:;
        memset(stage,0,sizeof(stage));
    }
    return 0;
}