#include <cstdio>
#include <cstdlib>

#define N 10
#define D 30

static int  n;
static int  w;
static int  d;
static char a[ D ][ N + 1 ];

int
FSA (
  int p,
  int r
  )
{
  if ( r == d ) return ( p == w - 1 );

  if ( p > 0 && a[ r ][ p - 1 ] == '1' )
  {
    return
    FSA ( p - 1, r + 1 );
  }
  if ( p < n - 1 && a[ r ][ p ] == '1' )
  {
    return
    FSA ( p + 1, r + 1 );
  }

  return
  FSA ( p, r + 1 );
}

int
main ( )
{
  int i, j;

  for ( ; ; )
  {
    int m;

    scanf ( " %d", &n );
    if ( n == 0 ) break ;
    scanf ( " %d %d %d", &m, &w, &d );

    for ( i = 0; i < d; ++i )
    {
      scanf ( " %s", a[ i ] );
    }

    if ( FSA ( m - 1, 0 ) )
    {
      puts ( "0" );
      continue ;
    }
    for ( i = 0; i < d; ++i )
    {
      for ( j = 0; j < n - 1; ++j )
      {
        if ( ( j == 0 || a[ i ][ j - 1 ] == '0' )
          && ( a[ i ][ j ] == '0' )
          && ( j == n - 2 || a[ i ][ j + 1 ] == '0' ) )
        {
          a[ i ][ j ] = '1';
          if ( FSA ( m - 1, 0 ) )
          {
            printf ( "%d %d\n", i + 1, j + 1 );
            break ;
          }
          a[ i ][ j ] = '0';
        }
      }
      if ( j != n - 1 ) break ;
    }
    if ( i == d )
    {
      puts ( "1" );
      continue ;
    }
  }

  return ( 0 );
}