#include <iostream>
#include <sstream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <queue>
#include <cmath>
#include <set>
#include <map>
#include <cstdlib>
#include <cstdio>
using namespace std;

bool check(int m, int hit, int d, vector<string> amida){
	for(int i = d-1; i >= 0; i--){
		if(amida[i][hit-1] == '1'){
			hit--;
		}else if(amida[i][hit] == '1'){
			hit++;
		}
	}

	return hit == m;
}

int main(){
	int n, m, hit, d;
	bool b;

	while(cin >> n, n){
		cin >> m >> hit >> d;
		vector<string> amida(d);
		vector<int> mp(n+1);

		for(int i = 0; i < d; i++){
			cin >> amida[i];
			amida[i] = "0" + amida[i] + "0";
		}

		b = check(m, hit, d, amida);
		pair<int, int> add;
		add.first = 0;

		for(int i = 0; i < d && !b; i++){
			for(int j = 1; j < n && !b; j++){
				if(amida[i][j] == '0' && amida[i][j-1] == '0' && amida[i][j+1] == '0'){
					amida[i][j] = '1';
					b = check(m, hit, d, amida);
					if(b){
						add.first = i+1;
						add.second = j;
					}
					amida[i][j] = '0';
				}
			}			
		}

		if(b){
			if(add.first != 0){
				cout << add.first << ' ' << add.second << endl;
			}else{
				cout << '0' << endl; 
			}
		}else{
			cout << '1' << endl; 
		}

	}
}