#include <cstdio>
using namespace std;

int n;
int m;
int p;
int d;
int field[100][100];

int GetGoalPos(int s) {
  for (int i=0; i<d; i++) {
    if (s < n-1 && field[i][s]) ++s;
    else if (s-1 >= 0 && field[i][s-1]) --s;
  }

  return s;
}

int solve() {
  scanf("%d", &n);
  if (n == 0) return -1;

  scanf("%d", &m);
  scanf("%d", &p);
  scanf("%d", &d);
  for (int i=0; i<d; i++) {
    for (int j=0; j<n-1; j++) {
      scanf("%1d", &field[i][j]);
    }
  }

  --m;
  --p;
  if (GetGoalPos(m) == p) {
    puts("0");
    return 0;
  }

  for (int i=0; i<d; i++) {
    for (int j=0; j<n-1; j++) {
      if (field[i][j]) continue;
      if (j-1 >= 0 && field[i][j-1]) continue;
      if (j+1 < n-1 && field[i][j+1]) continue;

      field[i][j] = 1;
      if (GetGoalPos(m) == p) {
        printf("%d %d\n", i+1, j+1);
        return 0;
      }
      field[i][j] = 0;
    }
  }

  puts("1");
}

int main() {
  while (1) {
    if (solve() == -1) return 0;
  }
}