#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;


#define NUM 502

struct Info{
	bool under_wall,right_wall;
};

struct State{
	bool wall_adj,no_wall_adj;
};

struct Data{
	Data(int arg_row,int arg_col){
		row = arg_row;
		col = arg_col;
	}
	int row,col;
};

int H,W,first_row,first_col;
int diff_row[4] = {-1,0,0,1},diff_col[4] = {0,-1,1,0};
bool pushed[NUM][NUM];
Info info[NUM][NUM];
State state[NUM][NUM];

bool rangeCheck(int row,int col){
	if(row >= 0 && row <= H+1 && col >= 0 && col <= W+1)return true;
	else{
		return false;
	}
}

void func(){

	for(int row = 0; row <= H; row++){
		for(int col = 0; col <= W; col++){
			info[row][col].under_wall = false;
			info[row][col].right_wall = false;
		}
	}

	int tmp;
	//壁の情報を取得
	for(int row = 1; row <= H; row++){

		for(int col = 1; col <= W; col++){
			scanf("%d",&tmp);
			info[row-1][col].under_wall = (tmp == 1);
		}
		for(int col = 1; col <= W+1; col++){
			scanf("%d",&tmp);
			info[row][col-1].right_wall = (tmp == 1);
		}
	}
	for(int col = 1; col <= W; col++){
		scanf("%d",&tmp);
		info[H][col].under_wall = (tmp == 1);
	}

	for(int row = 0; row <= H+1; row++){
		for(int col = 0; col <= W+1; col++){
			pushed[row][col] = false;
			state[row][col].wall_adj = false;
			state[row][col].no_wall_adj = false;
		}
	}

	queue<Data> Q;

	for(int col = 0; col <= W+1; col++){
		Q.push(Data(0,col));
		pushed[0][col] = true;
		Q.push(Data(H+1,col));
		pushed[H+1][col] = true;
	}
	for(int row = 1; row <= H; row++){
		Q.push(Data(row,0));
		pushed[row][0] = true;
		Q.push(Data(row,W+1));
		pushed[row][W+1] = true;
	}

	int adj_row,adj_col;

	while(!Q.empty()){

		if(Q.front().row == first_row && Q.front().col == first_col){

			printf("Yes\n");
			return;

		}else{

			for(int i = 0; i < 4; i++){
				adj_row = Q.front().row+diff_row[i];
				adj_col = Q.front().col+diff_col[i];

				if(rangeCheck(adj_row,adj_col) == false || pushed[adj_row][adj_col] == true)continue;

				switch(i){
				case 0: //上
					if(info[adj_row][adj_col].under_wall){
						state[adj_row][adj_col].wall_adj = true;
					}else{
						state[adj_row][adj_col].no_wall_adj = true;
					}
					break;
				case 1: //左
					if(info[adj_row][adj_col].right_wall){
						state[adj_row][adj_col].wall_adj = true;
					}else{
						state[adj_row][adj_col].no_wall_adj = true;
					}
					break;
				case 2: //右
					if(info[Q.front().row][Q.front().col].right_wall){
						state[adj_row][adj_col].wall_adj = true;
					}else{
						state[adj_row][adj_col].no_wall_adj = true;
					}
					break;
				case 3: //下
					if(info[Q.front().row][Q.front().col].under_wall){
						state[adj_row][adj_col].wall_adj = true;
					}else{
						state[adj_row][adj_col].no_wall_adj = true;
					}
					break;
				}

				if(state[adj_row][adj_col].wall_adj == true && state[adj_row][adj_col].no_wall_adj == true){
					Q.push(Data(adj_row,adj_col));
					pushed[adj_row][adj_col] = true;
				}
			}
			Q.pop();
		}
	}

	for(int i = 0; i < 4; i++){
		adj_row = first_row+diff_row[i];
		adj_col = first_col+diff_col[i];

		if(!pushed[adj_row][adj_col])continue;

		switch(i){
		case 0: //上
			if(!info[adj_row][adj_col].under_wall){
				printf("Yes\n");
				return;
			}
			break;
		case 1: //左
			if(!info[adj_row][adj_col].right_wall){
				printf("Yes\n");
				return;
			}
			break;
		case 2: //右
			if(!info[first_row][first_col].right_wall){
				printf("Yes\n");
				return;
			}
			break;
		case 3: //下
			if(!info[first_row][first_col].under_wall){
				printf("Yes\n");
				return;
			}
			break;
		}
	}

	printf("No\n");
}


int main(){

	while(true){
		scanf("%d %d %d %d",&H,&W,&first_row,&first_col);
		if(H == 0 && W == 0 && first_row == 0 && first_col == 0)break;

		func();
	}

	return 0;
}



Measured memory_bytes: 4356