#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>
#include <fstream>
#include <bitset>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef complex<double> Point;

#define PI acos(-1.0)
#define EPS 1e-10
const ll INF = 1e9 + 7;
const ll MOD = 1e9 + 7;

#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,N) for(long long i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
#define EQV(a,b) ( EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()) )
#define fi first
#define se second

int n, m, a, d;
bool table[100][100];
int ans;

void solve(int now, int cnt){
	//cout << "!" << now << endl;
	if (cnt == d){
		//cout << endl;
		if (now == a){
			//cout << "!!" << endl;
			ans = 0;
		}
		return;
	}
	bool f = 1;
	if (now > 0 && table[cnt][now - 1]){
		solve(now - 1, cnt + 1);
		f = 0;
	}
	if (now < n - 1 && table[cnt][now]){
		solve(now + 1, cnt + 1);
		f = 0;
	}
	if(f)solve(now, cnt + 1);
}

int main(){
	while (cin >> n&&n){
		ans = 1;
		cin >> m >> a >> d;
		m--; a--;
		REP(i, d){
			string s;
			cin >> s;
			REP(j, s.size())table[i][j] = s[j] - '0';
		}
		//REP(i, d){
		//	REP(j, n - 1){
		//		cout << table[i][j];
		//	}
		//	cout << endl;
		//}
		solve(m, 0);
		if (!ans){
			cout << ans << endl;
			continue;
		}
		bool f = 0;
		REP(i, d){
			REP(j, n - 1){
				if (table[i][j] == 0){
					if (j > 0 && table[i][j - 1])continue;
					if (j < n - 2 && table[i][j + 1])continue;
					table[i][j] = 1;
					solve(m, 0);
					if (!ans){
						cout << i + 1 << " " << j + 1 << endl;
						f = 1;
					}
					table[i][j] = 0;
				}
				if (f)break;
			}
			if (f)break;
		}
		if (!f)cout << ans << endl;
	}

}