#include <iostream>

using namespace std;

int n, m, h, d;
char in[9][30];

bool judge();
main(){
  while(1){
    cin >> n;
    if(n==0) break;
    cin >> m >> h >> d;
    for(int i=0;i<d;i++){
      for(int j=0;j<n-1;j++){
	cin >> in[i][j];
      }
    }
    if(judge()){
      cout << 0 << endl;
      continue;
    }
    bool end=false;
    for(int i=0;i<d;i++){
      for(int j=0;j<n-1;j++){
	if(in[i][j]=='0'){
	  in[i][j]='1';
	  if(judge()){
	    printf("%d %d\n", i+1, j+1);
	    end=true;
	    break;
	  }
	  in[i][j]='0';
	}
      }
      if(end) break;
    }
    if(end) continue;
    cout << 1 << endl;
  }
  return 0;
}

bool judge(){
  int tmp=m-1;
  int i;
  for(i=0;i<d;i++){
    if(tmp==0){
      if(in[i][0]=='1') tmp=1;
    }else if(tmp==n-1){
      if(in[i][n-2]=='1') tmp=n-2;
    }else{
      if(in[i][tmp]=='1') tmp++;
      else if(in[i][tmp-1]=='1') tmp--;
    }
  }
  if(tmp==h-1) return true;
  else return false;
}