#include <bits/stdc++.h>
using namespace std;
int d[4][2] = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
int sx, sy, ex, ey, n, m;
int cnt[505][505];
char a[505][505];
bool bfs() {
  queue<int> qx, qy;
  qx.push(sx);
  qy.push(sy);
  cnt[sx][sy] = 0;
  while (!qx.empty()) {
    int px = qx.front();
    qx.pop();
    int py = qy.front();
    qy.pop();
    for (int i = 0; i < 4; i++) {
      int tx = px + d[i][0];
      int ty = py + d[i][1];
      if (tx > 0 && tx <= n & ty > 0 && ty <= m) {
        if (cnt[tx][ty] == 0) {
          if (tx == ex && ty == ey) return 1;
        } else {
          qx.push(tx);
          qy.push(ty);
          cnt[tx][ty]--;
        }
      }
    }
  }
  return 0;
}
int main() {
  int i, j;
  scanf("%d %d", &n, &m);
  for (i = 0; i < n; i++) scanf("%s", &a[i]);
  for (i = 0; i < n; i++) {
    for (j = 0; j < m; j++) {
      if (a[i][j] == '.')
        cnt[i + 1][j + 1] = 1;
      else
        cnt[i + 1][j + 1] = 0;
    }
  }
  scanf("%d%d%d%d", &sx, &sy, &ex, &ey);
  if (bfs())
    printf("YES\n");
  else
    printf("NO\n");
  return 0;
}
