#include <iostream>
#include <iomanip>
#include <fstream>
#include <string>
#include <array>
#include <vector>
#include <deque>
#include <list>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <stack>
#include <queue>
#include <bitset>
#include <tuple>
#include <cmath>
#include <complex>
#include <algorithm>
#include <utility>
#include <regex>
#include <cstdint>
#include <numeric>
#include <functional>
#include <cassert>

using namespace std;
using ll = int64_t;
using ull = uint64_t;

constexpr ll INF = 1000000000;/* 1e+9a */
namespace solve{
    ll H, W, R, C;
    vector<vector<bool>> wt, wy;
    vector<vector<bool>> win;
    
    vector<pair<int, int>> dxy{{1, 0}, {0, 1}, {-1, 0}, {0, -1}};
    
    bool is_in(int x, int y){
        return 0 <= x and x < H and 0 <= y and y < W;
    }
    
    bool wall_one(int x, int y, int tx, int ty){
        if(x != tx) return wt[max(x, tx)][y];
        return wy[x][max(y, ty)];
    }
    
    bool can_win(int x, int y){
        bool zero, one;
        zero = one = false;
        for (auto &&d : dxy) {
            int tx = x + d.first;
            int ty =y + d.second;
            if(!is_in(tx, ty) or win[tx][ty]){
                if(wall_one(x, y, tx, ty)) one = true;
                else zero = true;
            }
        } // d
        
        return win[x][y] = (zero and one);
        
    }
    
    
    void sub_main(istream &cin) {
    
        cin >> H >> W >> R >> C;
        if (H == 0) return;
        wt.clear(); wy.clear();
        for (int i = 0; i < H; ++i) {
            vector<bool> tw;
            
            for (int j = 0; j < W; ++j) {
                int tmp;
                cin >> tmp;
                tw.push_back(tmp == 1);
            }// j
            wt.emplace_back(tw);
            tw.clear();
            for (int j = 0; j < W+1; ++j) {
                int tmp;
                cin >> tmp;
                tw.push_back(tmp == 1);
            }// j
            wy.emplace_back(tw);
        }// i
        vector<bool> tw;
    
        for (int j = 0; j < W; ++j) {
            int tmp;
            cin >> tmp;
            tw.push_back(tmp == 1);
        }// j
        wt.emplace_back(tw);
        
        //----------------------end input
    
        win.clear();
        win.resize(H, vector<bool>(W, false));
        queue<pair<int, int>> qxy;
        for (int i = 0; i < H; ++i) {
            qxy.emplace(i, 0);
            qxy.emplace(i, W-1);
        }// i
        for (int i = 0; i < W; ++i) {
            qxy.emplace(0, i);
            qxy.emplace(H-1, i);
        }// i
        
        while(!qxy.empty()){
            auto top = qxy.front(); qxy.pop();
            int x = top.first;
            int y = top.second;
            
            
            if(is_in(x, y) and !win[x][y]) {
                if(can_win(x, y)) {
                    for (auto &&d : dxy) {
                        int tx = x + d.first;
                        int ty = y + d.second;
                        qxy.emplace(tx, ty);
                    } // d
                }
            }
        }
        
        bool alicewin = false;
    
        for (auto &&d : dxy) {
            int tx = R-1 + d.first;
            int ty = C-1 + d.second;
            if(!wall_one(R-1, C-1, tx, ty) and
                    (!is_in(tx,ty)  or  win[tx][ty] ))
                alicewin = true;
        } // d
        
        cout << (alicewin ? "Yes" : "No") << endl;
        
        
    
    
    }
}

int main(int argc, char *argv[]) {
    using solve::sub_main;
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << setprecision(16) << scientific;
#ifdef DEBUG
    cerr << "DEBUG MODE" << endl;
    string test_cases = "test_1.txt";
    auto fs = fstream(test_cases, fstream::in);
    int lp = 0;
    while(fs) {
        lp++;
        cout << lp <<  "#------\n";
        sub_main(fs);
    }
    cout << "------#\n";
    if(lp <= 1) sub_main(cin);
#else
    while(cin) sub_main(cin);
#endif
    return 0;
}



Measured memory_bytes: 3300