#define _USE_MATH_DEFINES
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<climits>
#include<queue>
#include<map>
#include<set>
#include<vector>
#include<list>
#include<stack>
#include<cstring>
#include<string>
#include<cmath>
using namespace std;

int main(){
	int N;
	while(cin>>N,N){
		int M,W,D,dp[31][10];
		char S[30][9];
		for(int i=0;i<10;i++) dp[0][i]=i;
		cin>>M>>W>>D; M--; W--;
		for(int i=0;i<D;i++){
			for(int j=0;j<N;j++){
				if(j<N-1) cin>>S[i][j];
				if(j<N-1 && S[i][j]=='1'){
					dp[i+1][j] = dp[i][j+1];
					dp[i+1][j+1] = dp[i][j];
				}
				else if(j==0 || S[i][j-1]=='0'){
					dp[i+1][j] = dp[i][j];
				}
			}
		}
		if(dp[D][W]==M){
			puts("0"); continue;
		}
		int ws = dp[D][W],ans1=-1,ans2;
		for(int i=0;i<D;i++){
			for(int j=0;j<N-1;j++){
				if(S[i][j]=='0' && (j==0 || S[i][j-1]=='0') && (j==N-2 || S[i][j+1]=='0') &&
					((dp[i][j]==M && dp[i][j+1]==ws) || (dp[i][j]==ws && dp[i][j+1]==M))){
					ans1 = i+1; ans2 = j+1;
					goto OUT;
				}
			}
		}
		OUT:
		if(ans1==-1) puts("1");
		else printf("%d %d\n",ans1,ans2);
	}
}