#include <cstdio>
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
using namespace std;

int n, m, d, atari;
vector<string> input(32);

bool Input() {
	cin >> n;
	if(n == 0)
		return false;
	cin >> m >> atari >> d;
	
	for(int i = 0; i < d; i++)
		cin >> input[i];

	return true;
}

bool foo(vector<string> & modified) {
	int cur_posn = m - 1;

	for(int i = 0; i < d; i++) {
		if(cur_posn > 0) {
			if(cur_posn < n - 1 && modified[i][cur_posn] == '1')
				cur_posn++;
			else if(modified[i][cur_posn - 1] == '1')
				cur_posn--;
		}
		else {
			if(modified[i][cur_posn] == '1')
				cur_posn++;
		}
	}

	return cur_posn == atari - 1;
}

string solve() {
	if(foo(input))
		return "0";

	for(int i = 0; i < d; i++) {
		for(int j = 0; j < n - 1; j++) {
			if((input[i][j - 1] == input[i][j] && input[i][j] == input[i][j + 1] && input[i][j] == '0') ||
					(j == 0 && input[i][j] == input[i][j + 1]) ||
					(j == n - 2 && input[i][j] == input[i][j - 1])) {
				input[i][j] = '1';
				if(foo(input)) {
					cout << i + 1 << " " << j + 1;
					return "";
				}
				input[i][j] = '0';
			}
		}
	}

	return "1";
}

int main(void) {
	while(Input()) {
		cout << solve() << endl;
	}

	return 0;
}