#include <iostream>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
int main(){
	int n,M,s,d;
	while(cin >> n && n){
		cin >> M >> s >> d;
		M--,s--;
		string data[30];
		rep(i,d){
			cin >> data[i];
		}
		
		int m = M;
		rep(i,d){
			if(m > 0 && data[i][m-1]=='1'){m = m-1;}
			else if(m < n-1 && data[i][m]=='1'){m = m+1;}
		}
		if(m == s){
			cout << 1 << endl;
			continue;	
		}
		rep(y,d){
			rep(x,n-1){
				if(data[y][x] == '0'){
					m = M;
					data[y][x] = '1';
					bool f = false;
					rep(i,n-2)if(data[y][i] == '1' && data[y][i+1] == '1')f = true;
					if(!f){
						rep(i,d){
							if(m > 0 && data[i][m-1]=='1'){m = m-1;}
							else if(m < n-1 && data[i][m]=='1'){m = m+1;}
						}
						if(m == s){
							cout << y+1 << " " << x+1 << endl;
							goto end;
						}
					}
					data[y][x] = '0';
				}
			}
		}
		end:;
	}
}