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

int main(){
    while( true ){
        int n, m, s, d;
        string amida[30];
        cin >> n;
        if( !n ) break;
        cin >> m >> s >> d;
        for(int i = 0; i < d; i++){
            cin >> amida[i];
        }
        vector< vector<int> > cur(31, vector<int>(n,0));
        for(int i = 0; i < n; i++){
            cur[0][i] = i+1;
        }
        for(int i = 0; i < d; i++){
            vector<int> tmp( cur[i] );
            for(int j = 0; j < n-1; j++){
                if( amida[i][j] == '1' ){
                    swap( tmp[j], tmp[j+1] );
                }
            }
            cur[i+1] = tmp;
        }
        if( cur[d][s-1] == m ){
            cout << 0 << endl;
        }else{
            int a = cur[d][s-1];
            bool ok = false;
            for(int i = 0; i < d && !ok; i++){
                for(int j = 0; j < n-1 && !ok; j++){
                    if( amida[i][j] == '0' &&
                            ( !j       || amida[i][j-1] == '0' ) &&
                            ( j == n-2 || amida[i][j+1] == '0' ) &&
                            ((cur[i][j] == m && cur[i][j+1] == a ||
                              cur[i][j] == a && cur[i][j+1] == m )) ){
                        cout << i+1 << ' ' << j+1 << endl;
                        ok = true;
                    }
                }
            }
            if( !ok ) cout << 1 << endl;
        }
    }
    return 0;
}