#include<iostream>
#include<cstdio>
using namespace std;
int lot[13][30];
int lotrun(int s, int m);
int main(){
	int a;
	for(;;){
		int n,s,g,m;
		cin >>n;
		if(!n){break;}
		cin >>s>>g>>m;
		for(int i=0; i<13; i++){for(int j=0; j<30; j++){lot[i][j] = 0;}}
		for(int i=0; i<m; i++){for(int j=0; j<n-1; j++){scanf("%1d",&lot[j+1][i]);}}
		if(g == lotrun(s,m)){cout <<"0"<<endl;goto jump;}
		for(int i=0; i<m; i++){
			for(int j=1; j<n; j++){
				bool f = false;
				if(!lot[j-1][i] && !lot[j][i] && !lot[j+1][i]){lot[j][i] = 1;f = true;}
				if(g == lotrun(s,m)){cout <<i+1<<" "<<j<<endl;goto jump;}
				if(f){lot[j][i] = 0;}
			}
		}
		cout <<"1"<<endl;
		jump:;
	}
	return 0;
}
int lotrun(int s,int m){
	for(int i=0; i<m; i++){
		if(lot[s-1][i]){s--;}
		else if(lot[s][i]){s++;}
	}
	return s;
}