#include <bits/stdc++.h>
char M[505][505];
int Sx, Sy, Ex, Ey;
int visited[505][505];
int n, m;
int dfs(int x, int y) {
  if (visited[x][y] || x > n || x < 1 || y > m || y < 1) return 0;
  visited[x][y] = 1;
  if (M[x][y] != '.') return 0;
  if (x == Ex && y == Ey) return 1;
  if (dfs(x - 1, y)) return 1;
  if (dfs(x + 1, y)) return 1;
  if (dfs(x, y - 1)) return 1;
  if (dfs(x, y + 1)) return 1;
  return 0;
}
int main() {
  int cnt = 0;
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) {
    scanf("%s", &M[i][1]);
  }
  scanf("%d%d%d%d", &Sx, &Sy, &Ex, &Ey);
  M[Sx][Sy] = '.';
  if (M[Ex - 1][Ey] == '.') cnt++;
  if (M[Ex + 1][Ey] == '.') cnt++;
  if (M[Ex][Ey - 1] == '.') cnt++;
  if (M[Ex][Ey + 1] == '.') cnt++;
  if (Sx == Ex && Sy == Ey) {
    if (cnt < 1)
      printf("NO");
    else
      printf("YES");
    return 0;
  }
  if (cnt < 2 && M[Ex][Ey] == '.') {
    printf("NO");
    return 0;
  }
  M[Ex][Ey] = '.';
  if (dfs(Sx, Sy))
    printf("YES");
  else
    printf("NO");
  return 0;
}
