#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
const double EPS = 1e-9;
const ll mod = 1000000007;
const int inf = 1 << 30;
const ll linf = 1LL << 60;
const double PI = 3.14159265358979323846;

const int dx[4] = { 1, 0, -1, 0};
const int dy[4] = { 0, 1, 0, -1};

int h, w, r, c;
bool row[501][501], col[501][501];
bool esc[501][501];

void solve() {
    r--; c--;
    memset(esc, 0, sizeof(esc));
    memset(row, 0, sizeof(row));
    memset(col, 0, sizeof(col));
    rep(i,h*2+1) {
        if (i%2 == 0) rep(j,w) cin >> col[i/2][j];
        else rep(j,w+1) cin >> row[i/2][j];
    }
    queue<pi> que;
    rep(i,h) { que.push(pi(i,0)); que.push(pi(i,w-1)); }
    rep(i,w) { que.push(pi(0,i)); que.push(pi(h-1,i)); }

    while (!que.empty()) {
        pi p = que.front(); que.pop();
        if (esc[p.first][p.second]) continue;
        bool ok1 = false, ok2 = false;
        if (col[p.first][p.second] && (p.first == 0 || esc[p.first-1][p.second])) ok1 = true;
        if (col[p.first+1][p.second] && (p.first == h-1 || esc[p.first+1][p.second])) ok1 = true;
        if (row[p.first][p.second] && (p.second == 0 || esc[p.first][p.second-1])) ok1 = true;
        if (row[p.first][p.second+1] && (p.second == w-1 || esc[p.first][p.second+1])) ok1 = true;
        if (!col[p.first][p.second] && (p.first == 0 || esc[p.first-1][p.second])) ok2 = true;
        if (!col[p.first+1][p.second] && (p.first == h-1 || esc[p.first+1][p.second])) ok2 = true;
        if (!row[p.first][p.second] && (p.second == 0 || esc[p.first][p.second-1])) ok2 = true;
        if (!row[p.first][p.second+1] && (p.second == w-1 || esc[p.first][p.second+1])) ok2 = true;
        if (!ok1 || !ok2) continue;
        esc[p.first][p.second] = true;
        rep(i,4) {
            int tx = p.first+dx[i], ty=p.second+dy[i];
            if (tx < 0 || tx >= h || ty < 0 || ty >= w) continue;
            if (esc[tx][ty]) continue;
            que.push(pi(tx,ty));
        }
    }
    bool ok = false;
    if (!col[r][c] && (r == 0 || esc[r-1][c])) ok = true;
    if (!col[r+1][c] && (r == h-1 || esc[r+1][c])) ok = true;
    if (!row[r][c] && (c == 0 || esc[r][c-1])) ok = true;
    if (!row[r][c+1] && (c == w-1 || esc[r][c+1])) ok = true;

    if (ok) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}

int main() {
#ifndef LOCAL
    ios::sync_with_stdio(false);
    cin.tie(0);
#endif
    cout << fixed;
    cout.precision(20);
    cerr << fixed;
    cerr.precision(6);
#ifdef LOCAL
    //freopen("in.txt", "wt", stdout); //for tester
    freopen("in.txt", "rt", stdin);
#endif  
    while (cin >> h >> w >> r >> c) {
        if (h == 0 && w == 0 && r == 0 && c == 0) break;
        solve();
    }
    //cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
    return 0;
}

