#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define REP(i,a,n) for(int i=(a); i<(int)(n); i++) #define rep(i,n) REP(i,0,n) #define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it) #define ALLOF(c) (c).begin(), (c).end() typedef long long ll; string field[55]; int visited[55][55]; int vx[4] = {0,0,1,-1}; int vy[4] = {1,-1,0,0}; int main(){ ios::sync_with_stdio(false); int H, W; cin >> H >> W; int sx, sy, gx, gy; cin >> sx >> sy >> gx >> gy; rep(i,H){ cin >> field[i]; } sx--; sy--; gx--; gy--; pair p(sx, sy); queue< pair > que; que.push(p); while(!que.empty()){ p = que.front(); que.pop(); if(visited[p.first][p.second] == 1) continue; visited[p.first][p.second] = 1; if(p.first == gx && p.second == gy){ cout << "YES" << endl; return 0; } rep(k,8){ int nx = p.first + vx[k]; int ny = p.second + vy[k]; if(0<=nx && nx