#include<iostream>
#include<algorithm>
#include<cmath>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
int main(){
	int n,m,g,d; char b;
	END:while(cin>>n>>m>>g>>d,n){
		int hl[d][n-1],rtr[d+1],tr[d]; m--,g--; rtr[d]=g;
		rep(i,d)rep(j,n-1)cin>>b,hl[i][j]=b-'0';
		rep(i,d){
			rtr[d-i-1]=rtr[d-i];
			if(rtr[d-i-1]<n-1&&hl[d-i-1][rtr[d-i-1]])rtr[d-i-1]++;
			else if(rtr[d-i-1]>0&&hl[d-i-1][rtr[d-i-1]-1])rtr[d-i-1]--;
		}
		if(rtr[0]==m){
			cout<<1<<endl; continue;
		}
		rep(i,d){
			tr[i]=i>0?tr[i-1]:m;
			if(tr[i]<n-1&&hl[i][tr[i]])tr[i]++;
			else if(tr[i]>0&&hl[i][tr[i]-1])tr[i]--;
			else if(abs(tr[i]-rtr[i])==1&&(rtr[i]==n-1||!hl[i][rtr[i]])&&
				(rtr[i]==0||!hl[i][rtr[i]-1])){
				cout<<i+1<<" "<<min(tr[i],rtr[i])+1<<endl;
				goto END;
			}
		}
		cout<<0<<endl;
	}
	return 0;
}