#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<cassert>
#include<iostream>
#include<sstream>
#include<string>
#include<vector>
#include<queue>
#include<set>
#include<map>
#include<utility>
#include<numeric>
#include<algorithm>
#include<bitset>
#include<complex>

using namespace std;

typedef long long Int;
typedef vector<int> vint;
typedef pair<int,int> pint;
#define mp make_pair

template<class T> void pv(T a, T b) { for (T i = a; i != b; ++i) cout << *i << " "; cout << endl; }
template<class T> void chmin(T &t, T f) { if (t > f) t = f; }
template<class T> void chmax(T &t, T f) { if (t < f) t = f; }
int in() { int x; scanf("%d", &x); return x; }

string amida[40];

int main() {
	int n,m,s,d;
	while(n=in()){
		cin>>m>>s>>d;
		int i;
		m--;s--;
		for(i=0;i<d;i++)cin>>amida[i];
		for(i=d-1;i>=0;i--){
//cout<<"i "<<i<<endl;
//cout<<"s "<<s<<endl;
//cout<<endl;
			if(amida[i][s]=='1'){
				s++;
			}else if(0<s&&amida[i][s-1]=='1'){
				s--;
			}
		}
		if(m==s){
			cout<<0<<endl;
			continue;
		}
		for(i=0;i<d;i++){
//cout<<"i "<<i<<endl;
//cout<<"s "<<s<<endl;
//cout<<"m "<<m<<endl;
//cout<<endl;
			if(amida[i][s]=='1'){
				s++;
			}else if(0<s&&amida[i][s-1]=='1'){
				s--;
			}
			if(amida[i][m]=='1'){
				m++;
			}else if(0<m&&amida[i][m-1]=='1'){
				m--;
			}
			if(s==m-1){
				if((s==0||amida[i][s-1]=='0')&&(s>=n-1||amida[i][s]=='0')&&(s>=n-2||amida[i][s+1]=='0')){
					cout<<i+1<<" "<<s+1<<endl;
					break;
				}
			}
			if(s==m+1){
				if((m==0||amida[i][m-1]=='0')&&(m>=n-1||amida[i][m]=='0')&&(m>=n-2||amida[i][m+1]=='0')){
					cout<<i+1<<" "<<m+1<<endl;
					break;
				}
			}
		}
		if(i==d)cout<<1<<endl;
	}
	return 0;
}