#include <bits/stdc++.h>
using namespace std;

#define DUMP(x) cerr << #x << "=" << x << endl
#define DUMP2(x, y) cerr<<"("<<#x<<", "<<#y<<") = ("<<x<<", "<<y<<")"<< endl
#define BINARY(x) static_cast<bitset<16> >(x)

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define REP(i,m,n) for (int i=m;i<(int)(n);i++)

#define in_range(x, y, w, h) (0<=(int)(x) && (int)(x)<(int)(w) && 0<=(int)(y) && (int)(y)<(int)(h))
#define ALL(a) (a).begin(),(a).end()

typedef long long ll;
const int INF = 1e9;
typedef pair<int, int> PII;
int dx[4] = {1, 0, -1, 0}, dy[4] = {0, -1, 0, 1};

int main()
{
    int H, W, R, C;
    while (cin >> H >> W >> R >> C, H || W || R || C) {
        int wall[510][510][4] = {};
        bool is_winning[510][510] = {};

        for (int i=0; i<=H; i++) {
            for (int x=1; x<=W; x++) {
                int t; cin >> t;
                wall[i][x][3] = t;
                wall[i+1][x][1] = t;
            }
            if (i == H) break;
            for (int x=0; x<=W; x++) {
                int t; cin >> t;
                wall[i+1][x][0] = t;
                wall[i+1][x+1][2] = t;
            }
        }

        /**
        for (int y=1; y<=H; y++) {
            for (int x=1; x<=W; x++) {
                cerr << "(" << x << ", " << y << ") : ";
                rep(i, 4) cerr << wall[y][x][i] << " ";
                cerr << endl;
            }
        }
        **/

        for (int i=0; i<W+2; i++) {
            is_winning[0][i] = is_winning[H+1][i] = true;
        }
        for (int i=0; i<H+2; i++) {
            is_winning[i][0] = is_winning[i][W+1] = true;
        }

        /**
        cerr << "-----------------" << endl;
        rep(y, H+2) {
            rep(x, W+2) {
                cerr << is_winning[y][x] << " ";
            }
            cerr << endl;
        }
        **/

        queue<PII> Q;
        for (int i=1; i<=W; i++) {
            Q.emplace(i, 1);
            Q.emplace(i, H);
        }
        for (int i=1; i<=H; i++) {
            Q.emplace(1, i);
            Q.emplace(W, i);
        }

        while (Q.size()) {
            PII p = Q.front(); Q.pop();
            int x = p.first, y = p.second;

            bool ok1 = false, ok2 = false;
            rep(i, 4) {
                int nx = x+dx[i], ny = y+dy[i];
                assert(wall[y][x][i] == wall[ny][nx][(i+2)%4]);
                if (wall[y][x][i] == 0) {
                    ok1 |= is_winning[ny][nx];
                } else {
                    ok2 |= is_winning[ny][nx];
                }
            }

            if (ok1 && ok2) {
                is_winning[y][x] = true;
                rep(i, 4) {
                    int nx = x+dx[i], ny = y+dy[i];
                    if (!is_winning[ny][nx]) Q.emplace(nx, ny);
                }
            }

            /**
            cerr << "-----------------" << endl;
            rep(y, H+2) {
                rep(x, W+2) {
                    cerr << is_winning[y][x] << " ";
                }
                cerr << endl;
            }
            **/
        }

        bool ok = is_winning[R][C];
        rep(i, 4) {
            int nx = C + dx[i], ny = R + dy[i];
            if (wall[R][C][i] == 0) {
                ok |= is_winning[ny][nx];
            }
        }
        cout << (ok ? "Yes" : "No") << endl;
    }
}

Measured memory_bytes: 7472