#include <iostream>
#include <vector>

using namespace std;

bool is_ok(vector<vector<char>> &seq, int n, int m, int h, int d) {
  int cur = m - 1;
  for (int i = 0; i < d; ++i) {
    if ( (0 < cur) && (seq[i][cur-1] == '1') )
      --cur;
    else if ( (cur < n - 1) && seq[i][cur] == '1')
      ++cur;
  }
  return cur == (h - 1);
}

int main() {

  while (true) {
    int n, m, h, d;

    cin >> n >> m >> h >> d;

    if (cin.fail())
      break;

    vector<vector<char>> seq(d, vector<char>(n-1));

    for (int i = 0; i < d; ++i)
      for (int j = 0; j < n-1; ++j)
        cin >> seq[i][j];


    bool det1 = is_ok(seq, n, m, h, d);
    bool det2 = false;

    int i, j;
    for (i = 0; i < d && !det2; ++i) {
      for (j = 0; j < n-1 && !det2; ++j) {
        vector<vector<char>> seq2 = seq;
        if ( (j == 0 || seq2[i][j-1] == '0') && (j == n-2 || seq2[i][j+1] == '0') )
          seq2[i][j] = '1';
        if (is_ok(seq2, n, m, h, d))
          det2 = true;
      }
    }

    if (det1)
      cout << 0 << endl;
    else if (det2)
      cout << i << " " << j << endl;
    else
      cout << 1 << endl;
  }
}
