#include <bits/stdc++.h>
using namespace std;
int n, m;
int sx, sy, ex, ey;
char s[505][505];
bool ok = false;
int d[4][2] = {{0, -1}, {-1, 0}, {0, 1}, {1, 0}};
inline bool test(int x, int y) { return (x >= 0 && x < n && y >= 0 && y < m); }
void dfs(int x, int y) {
  if (x == ex && y == ey) {
    ok = true;
    return;
  }
  for (int i = 0; i < 4; i++) {
    int rx = x + d[i][0];
    int ry = y + d[i][1];
    if (test(rx, ry) && s[rx][ry] == '.') {
      s[rx][ry] = 'X';
      dfs(rx, ry);
      if (ok) return;
    }
  }
}
int getNum(int x, int y) {
  int sum = 0;
  for (int i = 0; i < 4; i++) {
    int rx = x + d[i][0];
    int ry = y + d[i][1];
    if (test(rx, ry) && s[rx][ry] == '.') sum++;
  }
  return sum;
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 0; i < n; i++) scanf("%s", s[i]);
  scanf("%d%d%d%d", &sx, &sy, &ex, &ey);
  sx--;
  sy--;
  ex--;
  ey--;
  s[sx][sy] = '.';
  int sun = getNum(ex, ey);
  if (sx == ex && sy == ey) {
    if (sun > 0)
      printf("YES\n");
    else
      printf("NO\n");
  } else {
    bool f = false;
    if (s[ex][ey] == 'X') {
      s[ex][ey] = '.';
      f = true;
    }
    dfs(sx, sy);
    if (ok && (f || sun > 1))
      printf("YES\n");
    else
      printf("NO\n");
  }
  return 0;
}
