#include <iostream>
using namespace std;

int n,m,h,d,map[11][30];

bool amida() {
  int x = m;
  for ( int i = 0; i < d; i++ ) {
    if ( map[x-1][i] != 0 ) {
      x--;
    }else if ( map[x][i] != 0 ) {
      x++;
    }
  }
  if ( x == h ) return true;
  return false;
}

int main() {

  while(true) {

    cin >> n;
    if ( n == 0 ) break;

    cin >> m >> h >> d;

    char input;

    for ( int i = 0; i < d; i++ ) {

      for ( int j = 0; j < n+1; j++ ) {

	if ( j == 0 || j == n ) {
	  map[j][i] = 0;
	}else {
	  cin >> input;
	  map[j][i] = input - '0';
	}

      }

    }

    if ( amida() ) {
      cout << 0 << endl;
    }else {

      bool flag = false;

      for ( int i = 0; i < d; i++ ) {

	for ( int j = 1; j < n; j++ ) {

	  if ( map[j-1][i] + map[j][i] + map[j+1][i] == 0 ) {

	    map[j][i] = 1;
	    if ( amida() ) {
	      cout << i+1 << " " << j << endl;
	      flag = true;
	      break;
	    }
	    map[j][i] = 0;

	  }

	}

	if ( flag ) break;

      }

      if ( flag == false ) {
	cout << 1 << endl;
      }

    }

  }
}