#include <bits/stdc++.h>
using namespace std;
int gox[4] = {1, -1, 0, 0};
int goy[4] = {0, 0, 1, -1};
struct Node {
  int x, y;
};
char mp[510][510];
int n, m, sx, sy, ex, ey;
queue<Node> q;
bool Bfs() {
  Node a, b;
  a.x = sx;
  a.y = sy;
  mp[sx][sy] = 'X';
  q.push(a);
  while (!q.empty()) {
    a = q.front();
    q.pop();
    if (a.x == ex && a.y == ey) return 1;
    for (int i = 0; i < 4; i++) {
      b = a;
      b.x += gox[i];
      b.y += goy[i];
      if (b.x >= 0 && b.x < n && b.y >= 0 && b.y < m && mp[b.x][b.y] == '.') {
        mp[b.x][b.y] = 'X';
        q.push(b);
      }
    }
  }
  return 0;
}
int main() {
  memset(mp, 0, sizeof(mp));
  scanf("%d%d", &n, &m);
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) scanf(" %c", &mp[i][j]);
  scanf("%d%d%d%d", &sx, &sy, &ex, &ey);
  sx--;
  sy--;
  ex--;
  ey--;
  int k = 0;
  if (ex > 0 && mp[ex - 1][ey] == '.') k++;
  if (ex < n - 1 && mp[ex + 1][ey] == '.') k++;
  if (ey > 0 && mp[ex][ey - 1] == '.') k++;
  if (ey < m - 1 && mp[ex][ey + 1] == '.') k++;
  if (sx == ex && sy == ey)
    if (k > 0) {
      printf("YES\n");
      return 0;
    } else {
      printf("NO\n");
      return 0;
    }
  if (mp[ex][ey] == '.' &&
      (k < 1 || (abs(sx - ex) + abs(sy - ey) > 1 && k < 2))) {
    printf("NO\n");
    return 0;
  }
  mp[ex][ey] = '.';
  mp[sx][sy] = '.';
  if (Bfs())
    printf("YES\n");
  else
    printf("NO\n");
  return 0;
}
