#include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <algorithm>	// require sort next_permutation count __gcd reverse etc.
#include <cstdlib>	// require abs exit atof atoi 
#include <cstdio>		// require scanf printf
#include <functional>
#include <numeric>	// require accumulate
#include <cmath>		// require fabs
#include <climits>
#include <limits>
#include <cfloat>
#include <iomanip>	// require setw
#include <sstream>	// require stringstream 
#include <cstring>	// require memset
#include <cctype>		// require tolower, toupper
#include <fstream>	// require freopen
#include <ctime>		// require srand
#define rep(i,n) for(int i=0;i<(n);i++)
#define ALL(A) A.begin(), A.end()

using namespace std;
int amida[12][35];

typedef long long ll;
typedef pair<int, int> P;

void disp_amida (int row, int col )
{
	rep (i, row ){
		rep (j, col ){
			cerr << amida[i][j];
		} // end rep
		cerr << endl;
	} // end rep
}

int do_amida (int row, int curr )
{
	rep (i, row ){
//		cerr << "curr: " << curr << endl;
		if (amida[i][curr] == 1 ){
			curr++;
		}else
		if (amida[i][curr-1] == 1 ){
			curr--;
		} // end if
	} // end rep
	
//	cerr << "curr: " << curr << endl;

	return curr; 
}

int main()
{
//	cut here before submit 
//	freopen ("testcase.DL2", "r", stdin );
	int n, m, b, d;
	while (scanf ("%d", &n ), n ){
		memset (amida, 0, sizeof (amida ) );
		scanf ("%d %d %d", &m, &b, &d );
		int res = -1;
		P ans;
		rep (i, d ){
			for (int j = 1; j <= n - 1; j++ ){
				scanf ("%1d", &amida[i][j] );
			} // end rep
		} // end rep

		vector<P> cand;
		rep (i, d ){
			for (int j = 1; j <= n - 1; j++ ){
				if (amida[i][j] == 0 && amida[i][j+1] == 0 && amida[i][j-1] == 0 ){
					cand.push_back (P(i, j ) );
				} // end if
			} // end for
		} // end rep
/*
		rep (i, cand.size() ){
			cerr << cand[i].first << ':' << cand[i].second << endl;
		} // end rep
*/
		int start = m;
		int end = do_amida (d, start );
		if (end == b ) res = 0;
		if (res != 0 ){
			rep (i, cand.size() ){
				int r = cand[i].first;
				int c = cand[i].second;
				amida[r][c] = 1;
				int s = m;
				int e = do_amida (d, s );
				if (e == b ){
					res = 1;
					ans = P (r, c ); 
					break;
				} // end if
				amida[r][c] = 0;
			} // end rep
		} // end if
		if (res != 1 ){
			cout << res << endl;
		}else{
			cout << ans.first+1 << ' ' << ans.second << endl;
		} // end if
	} // end loop

//	printf ("%d\n", res );
		
	return 0;
}