#include <bits/stdc++.h>
#define ll long long
#define INF 1000000005
#define MOD 1000000007
#define EPS 1e-10
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;--i)
#define srep(i,s,t) for(int i=(int)(s);i<(int)(t);++i)
#define each(a,b) for(auto& (a): (b))
#define all(v) (v).begin(),(v).end()
#define len(v) (int)(v).size()
#define zip(v) sort(all(v)),v.erase(unique(all(v)),v.end())
#define cmx(x,y) x=max(x,y)
#define cmn(x,y) x=min(x,y)
#define fi first
#define se second
#define pb push_back
#define show(x) cout<<#x<<" = "<<(x)<<endl
#define spair(p) cout<<#p<<": "<<p.fi<<" "<<p.se<<endl
#define sar(a,n) cout<<#a<<":";rep(pachico,n)cout<<" "<<a[pachico];cout<<endl
#define svec(v) cout<<#v<<":";rep(pachico,v.size())cout<<" "<<v[pachico];cout<<endl
#define svecp(v) cout<<#v<<":";each(pachico,v)cout<<" {"<<pachico.first<<":"<<pachico.second<<"}";cout<<endl
#define sset(s) cout<<#s<<":";each(pachico,s)cout<<" "<<pachico;cout<<endl
#define smap(m) cout<<#m<<":";each(pachico,m)cout<<" {"<<pachico.first<<":"<<pachico.second<<"}";cout<<endl

using namespace std;

typedef pair<int,int> P;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<double> vd;
typedef vector<P> vp;
typedef vector<string> vs;

const int MAX_N = 505;

inline bool up(int i, int j, int k, vvi& wall)
{
    return !(wall[2*i][j]^k);
}

inline bool down(int i, int j, int k, vvi& wall)
{
    return !(wall[2*i+2][j]^k);
}

inline bool left(int i, int j, int k, vvi& wall)
{
    return !(wall[2*i+1][j]^k);
}

inline bool right(int i, int j, int k, vvi& wall)
{
    return !(wall[2*i+1][j+1]^k);
}

bool ok[MAX_N][MAX_N][2];

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    while(1){
        int h,w,r,c;
        cin >> h >> w >> r >> c;
        if(h == 0) break;
        --r, --c;
        vvi wall(2*h+1);
        rep(i,2*h+1){
            if(i%2){
                wall[i].resize(w+1);
            }else{
                wall[i].resize(w);
            }
            rep(j,len(wall[i])){
                cin >> wall[i][j];
            }
        }
        if((r == 0 && up(r,c,0,wall)) || (r == h-1 && down(r,c,0,wall)) || (c == 0 && left(r,c,0,wall)) || (c == w-1 && right(r,c,0,wall))){
            cout << "Yes\n";
            continue;
        }
        rep(i,h){
            rep(j,w){
                rep(k,2){
                    ok[i][j][k] = false;
                }
            }
        }
        queue<P> que;
        srep(j,1,w-1){
            rep(k,2){
                if(up(0,j,k,wall)){
                    ok[0][j][k] = true;
                }
            }
            if(ok[0][j][0] && ok[0][j][1]) que.push(P(0,j));
        }
        srep(j,1,w-1){
            rep(k,2){
                if(down(h-1,j,k,wall)){
                    ok[h-1][j][k] = true;
                }
            }
            if(ok[h-1][j][0] && ok[h-1][j][1]) que.push(P(h-1,j));
        }
        srep(i,1,h-1){
            rep(k,2){
                if(left(i,0,k,wall)){
                    ok[i][0][k]  = true;
                }
            }
            if(ok[i][0][0] && ok[i][0][1]) que.push(P(i,0));
        }
        srep(i,1,h-1){
            rep(k,2){
                if(right(i,w-1,k,wall)){
                    ok[i][w-1][k] = true;
                }
            }
            if(ok[i][w-1][0] && ok[i][w-1][1]) que.push(P(i,w-1));
        }
        rep(k,2){
            if(left(0,0,k,wall)||up(0,0,k,wall)){
                ok[0][0][k] = true;
            }
        }
        if(ok[0][0][0] && ok[0][0][1]) que.push(P(0,0));
        rep(k,2){
            if(right(0,w-1,k,wall)||up(0,w-1,k,wall)){
                ok[0][w-1][k] = true;
            }
        }
        if(ok[0][w-1][0] && ok[0][w-1][1]) que.push(P(0,w-1));
        rep(k,2){
            if(left(h-1,0,k,wall)||down(h-1,0,k,wall)){
                ok[h-1][0][k] = true;
            }
        }
        if(ok[h-1][0][0] && ok[h-1][0][1]) que.push(P(h-1,0));
        rep(k,2){
            if(right(h-1,w-1,k,wall)||down(h-1,w-1,k,wall)){
                ok[h-1][w-1][k] = true;
            }
        }
        if(ok[h-1][w-1][0] && ok[h-1][w-1][1]) que.push(P(h-1,w-1));
        while(!que.empty()){
            P p = que.front();
            que.pop();
            rep(k,2){
                int nx = p.fi + 1, ny = p.se;
                if(nx >= 0 && nx < h && ny >= 0 && ny < w && up(nx,ny,k,wall) && !ok[nx][ny][k]){
                    ok[nx][ny][k] = true;
                    if(ok[nx][ny][k^1]) que.push(P(nx,ny));
                }
            }
            rep(k,2){
                int nx = p.fi, ny = p.se + 1;
                if(nx >= 0 && nx < h && ny >= 0 && ny < w && left(nx,ny,k,wall) && !ok[nx][ny][k]){
                    ok[nx][ny][k] = true;
                    if(ok[nx][ny][k^1]) que.push(P(nx,ny));
                }
            }
            rep(k,2){
                int nx = p.fi, ny = p.se - 1;
                if(nx >= 0 && nx < h && ny >= 0 && ny < w && right(nx,ny,k,wall) && !ok[nx][ny][k]){
                    ok[nx][ny][k] = true;
                    if(ok[nx][ny][k^1]) que.push(P(nx,ny));
                }
            }
            rep(k,2){
                int nx = p.fi - 1, ny = p.se;
                if(nx >= 0 && nx < h && ny >= 0 && ny < w && down(nx,ny,k,wall) && !ok[nx][ny][k]){
                    ok[nx][ny][k] = true;
                    if(ok[nx][ny][k^1]) que.push(P(nx,ny));
                }
            }
        }
        if(ok[r][c][0] && ok[r][c][0]){
            cout << "Yes\n";
        }else{
            cout << "No\n";
        }
    }
    return 0;
}


Measured memory_bytes: 5512