#include <bits/stdc++.h>   using namespace std;   const int dx[] = {0, 0, 1, -1};   const int dy[] = {1, -1, 0, 0};   int s[505][505];   queue<pair<int, int> > q;   char c[505][505];   bitset<505> b[505];   int main(void) {     int n, m;     cin >> n >> m;     for (int i = 1; i <= n; ++i) cin >> (c[i] + 1);     int x1, y1, first, second;     cin >> first >> second >> x1 >> y1;     s[first][second] = 1;     q.push(make_pair(first, second));     while (q.size()) {       int k = q.front().first, l = q.front().second;       q.pop();       for (int p = 0; p < 4; ++p) {         int f = k + dx[p];         int g = l + dy[p];         if ((c[f][g] ==  . ) && !s[f][g])           s[f][g] = s[k][l] + 1, q.push(make_pair(f, g));       }     }     int p = 0, g = 0;     for (int l = 0; l < 4; ++l)       p += c[x1 + dx[l]][y1 + dy[l]] ==  . , g |= s[x1 + dx[l]][y1 + dy[l]];     if (c[x1][y1] ==  X ) return cout << (g ?  YES  :  NO ) <<   n , 0;     if (!s[x1][y1]) return cout <<  NO n , 0;     if (p > 1 || (abs(first - x1) + abs(second - y1) == 1 && p >= 1))       return cout <<  YES n , 0;     return cout <<  NO n , 0;   }   