#include <iostream>
int m, n, s=0;
int startx, starty;
int endx, endy;
int a[20][20];
void input();
void DFSmaze(int x, int y);
void output();
int main()
{
input();
DFSmaze(startx, starty);
output();
return 0;
}
void input()
{
std::cin >> m >> n;
std::cin >> startx >> starty;
std::cin >> endx >> endy;
for (int i = 0; i < m; i++)
{
for (int j = 0; j < n; j++)
{
std::cin >> a[i][j];
}
}
}
void DFSmaze(int x, int y)
{
a[x][y] = 2;
if (x == endx && y == endy)
{
s = 1;
}
else
{
if (x + 1 < m && x + 1 >= 0 && a[x + 1][y] == 0) //down
{
DFSmaze(x + 1, y);
}
if (x - 1 < m && x - 1 >= 0 && a[x - 1][y] == 0) //up
{
DFSmaze(x - 1, y);
}
if (y + 1 < n && y + 1 >= 0 && a[x][y + 1] == 0) //right
{
DFSmaze(x, y + 1);
}
if (y - 1 < n && y - 1 >= 0 && a[x][y - 1] == 0)//left
{
DFSmaze(x, y - 1);
}
}
}
void output()
{
if (s == 1)
std::cout << "Yes" << std::endl;
else
std::cout << "No" << std::endl;
}