#include <iostream>
#include <sstream>
#include <algorithm>
#include <cstdio>
#include <string>
#include <vector>

//AOJ0069
#define rep(x,to) for(int x=0;x<to;x++)
#define rep2(x,from,to) for(int x=from;x<to;x++)

using namespace std;


int atri(int ind, int d, string wam[]){
	int z = ind;
	rep2(i,1,d+1){
		if(wam[i][z-1]=='1')  z--;
		else if(wam[i][z]=='1') z ++;
	}
	return z;
}

int main(void){
int n,hi,at,d;
string ws,am[32];
	
	while(cin >> n){
		if(n==0 || cin.eof()) break;
		cin >> hi >> at >> d;
		rep(i,d){
			cin >> ws;
//			if(ws == "0" ) break;
			am[i+1] = "0" + ws + "0";
		}
		
		int svat=atri(hi,d,am);
//		printf("ss:%d %d \n",hi, svat);
		int ngsw = 0,  ans = -1;
		if(svat == at){
			ans = 0;
		}else{
			rep2(i,1,d+1) rep2(j,1,n+1){
				if( am[i][j-1] =='1') continue;
				if( am[i][j+1] =='1') continue;
				if( am[i][j] =='1' ) continue;
				
				am[i][j] = '1';
				if(at == atri(hi,d,am)){
					cout << i << " " << j <<endl;
					ngsw=1;
					goto HITEND;
				}
				am[i][j] = '0';
			}
			if(ngsw==0) ans = 1;
		}
		if(ngsw==0) cout << ans <<endl;	
		HITEND:	;
	}
	return 0;
	
}