#include <bits/stdc++.h>
char a[555][555];
int d[555][555];
int sx, sy, fx, fy;
void dfs(int x, int y) {
  if (d[x][y]) return;
  if ((x != fx || y != fy) && (x != sx || y != sy) && a[x][y] != '.') return;
  d[x][y] = 1;
  dfs(x + 1, y);
  dfs(x - 1, y);
  dfs(x, y + 1);
  dfs(x, y - 1);
}
int main() {
  int i, j, n, m;
  scanf("%d%d", &n, &m);
  for (i = 1; i <= n; i++) scanf("%s", a[i] + 1);
  scanf("%d%d%d%d", &sx, &sy, &fx, &fy);
  a[sx][sy] = '.';
  dfs(sx, sy);
  if (!d[fx][fy])
    printf("%s", "NO");
  else if (sx == fx && sy == fy &&
           (a[fx + 1][fy] == '.') + (a[fx - 1][fy] == '.') +
                   (a[fx][fy + 1] == '.') + (a[fx][fy - 1] == '.') <
               1)
    printf("%s", "NO");
  else if (sx == fx && sy == fy &&
           (a[fx + 1][fy] == '.') + (a[fx - 1][fy] == '.') +
                   (a[fx][fy + 1] == '.') + (a[fx][fy - 1] == '.') >
               0)
    printf("%s", "YES");
  else if (a[fx][fy] == 'X')
    printf("%s", "YES");
  else if ((a[fx + 1][fy] == '.') + (a[fx - 1][fy] == '.') +
               (a[fx][fy + 1] == '.') + (a[fx][fy - 1] == '.') <
           2)
    printf("%s", "NO");
  else
    printf("%s", "YES");
}
