#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
using namespace std;
int n,m,t,d;
string fld[32];
bool amida(){
    int pos=t;
    for(int i=d-1;i>=0;i--){
        if(fld[i][pos-1]=='1')pos--;
        else if(fld[i][pos]=='1')pos++;
    }
    if(pos==m)return true;
    else return false;
}
int main(){
    while(cin>>n,n){
        cin>>m>>t>>d;
        for(int i=0;i<d;i++){
            string str;
            cin>>str;
            fld[i]="0"+str+"0";
        }
        if(amida()){
            cout<<0<<endl;
            break;
        }
        bool flag=true;
        for(int i=0;i<d;i++){
            string str=fld[i];
            for(int j=1;j<n;j++){
                if(str[j]!='0'||str[j-1]!='0'||str[j+1]!='0')continue;
                fld[i][j]='1';
                if(amida()){
                    cout<<i+1<<" "<<j<<endl;
                    flag=false;
                    break;
                }
                fld[i][j]='0';
            }
            if(!flag)break;
        }

        if(flag)cout<<1<<endl;
    }
}