#include <bits/stdc++.h>
#pragma warning(disable : 4996)
using namespace std;
int n, m;
int sx, sy, ex, ey;
char a[600][600];
int c[600][600];
vector<pair<int, int> > q;
int dir[4][2] = {1, 0, 0, 1, -1, 0, 0, -1};
int main() {
  int i, j, k;
  cin >> n >> m;
  for (i = 0; i < n + 2; i++)
    for (j = 0; j < m + 2; j++) a[i][j] = 'X';
  for (i = 0; i < n; i++) scanf("%s", a[i + 1] + 1);
  cin >> sx >> sy >> ex >> ey;
  n += 2, m += 2;
  c[sx][sy] = 1;
  q.push_back(pair<int, int>(sx, sy));
  for (i = 0; i < q.size(); i++) {
    int nowx = q[i].first, nowy = q[i].second;
    for (j = 0; j < 4; j++) {
      int nx = nowx + dir[j][0], ny = nowy + dir[j][1];
      if ((a[nx][ny] == '.' || nx == ex && ny == ey) && c[nx][ny] == 0)
        c[nx][ny] = 1, q.push_back(pair<int, int>(nx, ny));
    }
  }
  if (c[ex][ey] == 0) return printf("NO"), 0;
  if (ex == sx && ey == sy) {
    if (a[sx + 1][sy] == '.' || a[sx][sy + 1] == '.' || a[sx - 1][sy] == '.' ||
        a[sx][sy - 1] == '.')
      printf("YES");
    else
      printf("NO");
  } else if (abs(ex - sx) + abs(ey - sy) == 1) {
    if (a[ex][ey] == 'X')
      printf("YES");
    else {
      if (a[ex + 1][ey] == '.' || a[ex][ey + 1] == '.' ||
          a[ex - 1][ey] == '.' || a[ex][ey - 1] == '.')
        printf("YES");
      else
        printf("NO");
    }
  } else {
    if (a[ex][ey] == 'X')
      printf("YES");
    else {
      int x = (a[ex + 1][ey] == '.') + (a[ex][ey + 1] == '.') +
              (a[ex - 1][ey] == '.') + (a[ex][ey - 1] == '.');
      if (x >= 2)
        printf("YES");
      else
        printf("NO");
    }
  }
  return 0;
}
