#include <bits/stdc++.h>
using namespace std;
int M, N, ans[500][500], r1, c1, r2, c2, flag = 0;
char pos[500][500];
void dfs(int X, int Y) {
  ans[X][Y] = 1;
  if ((abs(X - r2) + abs(Y - c2)) <= 1) {
    ans[r2][c2] = 1;
    flag = 1;
    return;
  }
  if (X < N - 1 && ans[X + 1][Y] == 0 && pos[X + 1][Y] == '.' && flag == 0) {
    dfs(X + 1, Y);
    pos[X + 1][Y] = 'X';
  }
  if (X > 0 && ans[X - 1][Y] == 0 && pos[X - 1][Y] == '.' && flag == 0) {
    dfs(X - 1, Y);
    pos[X - 1][Y] = 'X';
  }
  if (Y < M - 1 && ans[X][Y + 1] == 0 && pos[X][Y + 1] == '.' && flag == 0) {
    dfs(X, Y + 1);
    pos[X][Y + 1] = 'X';
  }
  if (Y > 0 && ans[X][Y - 1] == 0 && pos[X][Y - 1] == '.' && flag == 0) {
    dfs(X, Y - 1);
    pos[X][Y - 1] = 'X';
  }
}
int main() {
  scanf("%d%d", &N, &M);
  int i, j;
  for (i = 0; i < N; i++) {
    scanf("%s", pos[i]);
  }
  memset(ans, 0, sizeof(ans));
  scanf("%d%d%d%d", &r1, &c1, &r2, &c2);
  r1--;
  c1--;
  r2--;
  c2--;
  dfs(r1, c1);
  if (r1 == r2 && c1 == c2) {
    if (pos[r2 - 1][c2] == '.' || pos[r2 + 1][c2] == '.' ||
        pos[r2][c2 + 1] == '.' || pos[r2][c2 - 1] == '.')
      printf("YES");
    else
      printf("NO");
  } else {
    if (ans[r2][c2]) {
      if (pos[r2][c2] == 'X')
        printf("YES");
      else {
        if (pos[r2 - 1][c2] == '.' || pos[r2 + 1][c2] == '.' ||
            pos[r2][c2 + 1] == '.' || pos[r2][c2 - 1] == '.')
          printf("YES");
        else
          printf("NO");
      }
    } else
      printf("NO");
  }
}
