#include <bits/stdc++.h>
using namespace std;
int n, m;
int sx, sy, ex, ey;
int dir[4][2] = {0, 1, 1, 0, 0, -1, -1, 0};
char str[510][510];
struct node {
  int x;
  int y;
};
int bfs() {
  queue<node> Q;
  node now, tmp;
  now.x = sx;
  now.y = sy;
  Q.push(now);
  while (!Q.empty()) {
    now = Q.front();
    Q.pop();
    for (int i = 0; i < 4; i++) {
      tmp.x = now.x + dir[i][0];
      tmp.y = now.y + dir[i][1];
      if (tmp.x >= 0 && tmp.x < n && tmp.y >= 0 && tmp.y < m) {
        if (tmp.x == ex && tmp.y == ey) {
          if (str[tmp.x][tmp.y] == '.')
            str[tmp.x][tmp.y] = 'X';
          else
            return 1;
          Q.push(tmp);
        } else if (str[tmp.x][tmp.y] == '.') {
          str[tmp.x][tmp.y] = 'X';
          Q.push(tmp);
        }
      }
    }
  }
  return 0;
}
int main() {
  while (scanf("%d%d", &n, &m) != EOF) {
    for (int i = 0; i < n; i++) scanf("%s", str[i]);
    scanf("%d%d%d%d", &sx, &sy, &ex, &ey);
    sx--, sy--, ex--, ey--;
    if (bfs())
      printf("YES\n");
    else
      printf("NO\n");
  }
  return 0;
}
