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

char l[12][32];

int main()
{
    
    int n,m,atari,d;
    while(cin>>n>>m>>atari>>d)
    {
        memset(l,'0',sizeof(l));
        for(int j=1;j<d+1;j++)for(int i=1;i<n;i++)cin >> l[i][j];

        int x = m;
        for(int j=1;j<d+1;j++)
        {
            if(l[x-1][j] == '1'){x--; continue;}
            if(l[x][j] == '1'){x++; continue;}
        }
        if(x == atari){cout << 0<<endl; continue;}
        int na = 1;
        for(int s=1;s<d+1;s++)
        {
            for(int t=1;t<n;t++)
            {
                if(l[t-1][s]=='0'&&l[t][s]=='0'&&l[t+1][s]=='0')
                {
                l[t][s] = '1';
                x = m;
                for(int j=1;j<d+1;j++)
                {
                    if(l[x-1][j] == '1'){x--; continue;}
                    if(l[x][j] == '1'){x++; continue;}
                }
                if(x == atari){cout <<s <<" "<< t <<endl; na = 0; break;}
                if(na==0) {break;}
                l[t][s] = '0';
                }
            }
            if(na==0) {break;}
        }
        if(na) cout << 1<<endl;
    }
    return 0;
}