#include <bits/stdc++.h>
using namespace std;

int n, m, p, d;
int grid[100][100];

bool check()
{
	int y = 1;
	int x = m;
	for (; y <= d; y++){
		x += grid[y][x];
	}
	return p == x;
}

int main()
{
	while (scanf("%d", &n), n){
		memset(grid, 0, sizeof(grid));
		scanf("%d %d %d", &m, &p, &d);
		for (int y = 1; y <= d; y++){
			for (int x = 1; x <= n - 1; x++){
				char c;
				scanf(" %c", &c);
				if (c != '1') continue;
				grid[y][x] = 1;
				grid[y][x + 1] = -1;
			}
		}
		
		if (check()){
			puts("0");
			continue;
		}
		
		for (int y = 1; y <= d; y++){
			for (int x = 1; x <= n - 1; x++){
				if (grid[y][x] || grid[y][x + 1]) continue;
				grid[y][x] = 1;
				grid[y][x + 1] = -1;
				if (check()){
					printf("%d %d\n", y, x);
					goto BREAK;
				}
				grid[y][x] = 0;
				grid[y][x + 1] = 0;
			}
		}
		
		puts("1");
		
		BREAK:;
	}
	return 0;
}