#include<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<n;i++)
using namespace std;
typedef pair<int, int>P;

char s[30][11];
int main() {
	int n;
	while (scanf("%d", &n), n) {
		int m, h, d; scanf("%d%d%d", &m, &h, &d);
		m--; h--;
		rep(i, d)scanf("%s", s[i]);
		bool flag = false;
		rep(i, d)rep(j, n - 1) {
			if ((j&&s[i][j - 1] == '1') || (j + 1 < n - 1 && s[i][j + 1] == '1'))continue;
			if (flag&&s[i][j] == '1')continue;
			vector<P>v;
			bool b = false;
			if (s[i][j] == '1')flag = b = true;
			s[i][j] = '1';
			rep(k, d)rep(t, n - 1) {
				if (s[k][t] == '1')v.push_back(P(t, t + 1));
			}
			int pos = m;
			for (P p : v) {
				if (p.first == pos)pos = p.second;
				else if (p.second == pos)pos = p.first;
			}
			if (pos == h) {
				if (b)puts("0");
				else printf("%d %d\n", i + 1, j + 1);
				goto g;
			}
			if (!b)s[i][j] = '0';
		}
		puts("1");
	g:;
	}
}