#include<iostream>
#include<string>
using namespace std;
int n, m, p, d; bool x[32][12], y[32][12];
bool hantei() {
	int A = m;
	for (int i = 1; i <= d; i++) {
		if (y[i][A] == true)A++;
		else if (y[i][A - 1] == true)A--;
	}
	if (A == p)return true;
	return false;
}
int main() {
	while (true) {
		for (int i = 0; i < 384; i++)x[i / 12][i % 12] = false;
		cin >> n; if (n == 0)break; cin >> m >> p >> d;
		for (int i = 1; i <= d; i++) {
			string S; cin >> S;
			for (int j = 0; j < n - 1; j++) {
				x[i][j + 1] = (bool)(S[j] - '0'); y[i][j + 1] = x[i][j + 1];
			}
		}
		if (hantei() == true) { cout << "0" << endl; goto E; }
		for (int i = 1; i <= d; i++) {
			for (int j = 1; j <= n; j++) {
				for (int k = 0; k < 384; k++)y[k / 12][k % 12] = x[k / 12][k % 12];
				y[i][j] = true;
				if (hantei() == true) { cout << i << ' ' << j << endl; goto E; }
			}
		}
		cout << "1" << endl;
	E:;
	}
	return 0;
}