#include <bits/stdc++.h>
using namespace std;
const int maxn = 500 + 5;
const int INF = 0x3f3f3f3f;
const int dr[] = {0, 0, 1, -1};
const int dc[] = {1, -1, 0, 0};
struct node {
  int r, c;
  node(int rr = 0, int cc = 0) : r(rr), c(cc) {}
};
int n, m;
char s[maxn][maxn];
int r2, c2;
bool is_in(int r, int c) { return r >= 0 && r < n && c >= 0 && c < m; }
bool bfs(int r, int c) {
  queue<node> q;
  q.push(node(r, c));
  s[r][c] = 'X';
  while (!q.empty()) {
    node u = q.front();
    q.pop();
    for (int i = 0; i < 4; ++i) {
      int x = u.r + dr[i];
      int y = u.c + dc[i];
      if (x == r2 && y == c2 && s[x][y] == 'X') return true;
      if (is_in(x, y) && s[x][y] == '.') {
        s[x][y] = 'X';
        q.push(node(x, y));
      }
    }
  }
  return false;
}
int main() {
  scanf("%d %d", &n, &m);
  for (int i = 0; i < n; ++i) scanf("%s", s[i]);
  int r1, c1;
  cin >> r1 >> c1 >> r2 >> c2;
  --r1, --r2, --c1, --c2;
  if (bfs(r1, c1))
    puts("YES");
  else
    puts("NO");
  return 0;
}
