#include<iostream>
#include<string>
#include<vector>
using namespace std;
int n, m, atari, d;
bool check(vector<int> line, vector< vector<int> > sideline, int col=-1, int row=-1){
	int i,j;
	if(col!=-1 && row!=-1)sideline[col][row] = 1;
	for(i=0;i<d;i++){
		for(j=0;j<n-1;j++){
			if(sideline[i][j] == 1){
				swap(line[j], line[j+1]);
			}
		}
	}
	if(line[atari-1] == m){
		return true;
	}
	return false;
}
int main(){
	int i, j;
	bool flg;
	string str;
	while(true){
		cin>>n;if(n==0)break;
		cin>>m>>atari>>d;
		vector<int> line(n);
		for(i=0;i<n;i++) line[i] = i+1;
		vector< vector<int> > sideline(d, vector<int>(n-1));
		for(i=0;i<d;i++){
			cin>>str;
			for(j=0;j<n-1;j++){
				sideline[i][j] = str[j] - '0';
			}
		}
		if(check(line, sideline) == true){
			cout<<0<<endl;
			continue;
		}
		flg = false;
		for(i=0;i<d;i++){
			for(j=0;j<n-1;j++){
				if(j==0){
					if(sideline[i][j+1] != 1){
						flg = check(line, sideline, i, j);
					}
				}else if(0<j && j<n-2){
					if((sideline[i][j+1] != 1) && (sideline[i][j-1] != 1)){
						flg = check(line, sideline, i, j);
					}
				}else if(j==n-2){
					if(sideline[i][j-1] != 1){
						flg = check(line, sideline, i, j);
					}
				}
				if(flg)break;
			}
			if(flg)break;
		}
		if(flg){
			cout<<i+1<<" "<<j+1<<endl;
		}else{
			cout<<"0"<<endl;
		}
	}
	return 0;
}