#include<iostream>
#include<algorithm>
#include<vector>
#include<cstdio>
#include<cstring>
#include<climits>
#include<cfloat>
#include<cmath>
#include<map>
#include<complex>

#define f first
#define s second
#define mp make_pair

#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define FOR(i,c) for(__typeof((c).begin()) i=(c).begin(); i!=(c).end(); i++)
#define ALL(c) (c).begin(), (c).end()

typedef unsigned int uint;
typedef long long ll;

using namespace std;

int main(){
  int n, m, h, d;
  while(scanf("%d",&n),n){
    scanf("%d%d%d",&m,&h,&d); h--; m--;
    char buff[16];
    int sen[d+1][n-1];
    int memo[d+1][n];
    memset(sen,0,sizeof(sen));
    REP(i,n) memo[0][i] = i;
    REP(i,d){
      REP(j,n) memo[i+1][j] = memo[i][j];
      scanf("%s",buff);
      //puts(buff);
      REP(j,n-1){
        sen[i][j] = buff[j] - '0';
        if(sen[i][j] == 1)
          swap(memo[i+1][j], memo[i+1][j+1]);
      }
      //REP(j,n) printf("%d%c",memo[i][j]+1,(j!=n-1&&sen[i][j]==1?'-':' ')); puts("");
    }
    int atari = memo[d][h];
    //cout << atari << endl;
    if(atari == m){
      puts("0");
    }else{
      bool flag = false;
      REP(dd,d+1){
        int idx;
        REP(i,n){
          if(memo[dd][i] == m){
            idx = i;
            break;
          }
        }
        if(idx != 0 && memo[dd][idx-1] == atari){
          if(sen[dd][idx-1] == 0){
            if(idx == n-1 || sen[dd][idx] == 0){
              if(idx == 1 || sen[dd][idx-1] == 0){
                flag = true;
                printf("%d %d",dd+1,idx);
              }
            }
          }
        }
        if(idx != n-1 && memo[dd][idx+1] == atari){
          if(sen[dd][idx] == 0){
            if(idx == 0 || sen[dd][idx-1] == 0){
              if(idx == n-2 || sen[dd][idx+1] == 0){
                flag = true;
                printf("%d %d\n",dd+1,idx+1);
              }
            }
          }
        }
        if(flag) break;
      }
      if(!flag)
        puts("1");
    }
  }
  return 0;
}