#include<iostream>
#include<vector>
using namespace std;

int n,m,goal,d;

bool check(vector<int>line,vector<string>path)
{
  int i,j;
  for(i=0;i<d;i++)
    for(j=0;j<n-1;j++)
      if(path[i][j]=='1')swap(line[j],line[j+1]);
  return line[goal-1]==m;
}

int main()
{
  int i,j;
  vector<int> line;
  vector<string> path;
  bool f;
  while(cin>>n,n){
    cin>>m>>goal>>d;
    line.resize(n);
    path.resize(d);
    for(i=0;i<n;i++)line[i]=i+1;
    for(i=0;i<d;i++)cin>>path[i];
    f=check(line,path)*2;
    for(i=0;!f && i<d;i++){
      for(j=0;!f && j<n-1;j++){
	if(path[i][j]=='1')continue;
	if(0<j && path[i][j-1]=='1')continue;
	if(j<n-1 && path[i][j+1]=='1')continue;
	path[i][j]='1';
	f=check(line,path);
	path[i][j]='0';
      }
    }
    if(f==2)puts("0");
    else if(f==0)puts("1");
    else cout<<i<<" "<<j<<endl;
  }
}