#include<iostream>
#include<cstdio>
using namespace std;
int n,m,r,d,f[13][30];
bool ans(int x=m);
int main(){
  while(cin >>n,n){
    cin >>m>>r>>d;
    for(int i=0; i<13; i++) for(int j=0; j<30; j++) f[i][j] = 0;
    for(int i=0; i<d; i++) for(int j=0; j<n-1; j++) scanf("%1d",&f[j+1][i]);
    if(ans()){cout <<"0"<<endl;goto jump;}
    for(int i=0; i<d; i++){
      for(int j=1; j<n; j++){
	if(f[j][i] == 0 && f[j-1][i] == 0 && f[j+1][i] == 0){
	  f[j][i] = 1;
	  if(ans()){cout <<i+1<<" "<<j<<endl;goto jump;}
	  f[j][i] = 0;
	}
      }
    }
    cout <<"1"<<endl;
  jump:;
  }
  return 0;
}
bool ans(int x){
  for(int i=0; i<d; i++){
    if(f[x-1][i] == 1) x--;
    else if(f[x][i] == 1) x++;
  }
  return x == r;
}