#include <bits/stdc++.h>
int n = 0, m = 0;
int walk(int, int, int, int, char**);
void print(char**);
int main(void) {
  int i, j;
  scanf("%d %d", &m, &n);
  getchar();
  char** map = (char**)malloc(sizeof(char*) * m);
  for (i = 0; i < m; i++) {
    map[i] = (char*)malloc(sizeof(char) * n);
    for (j = 0; j < n; j++) {
      scanf("%c", &map[i][j]);
    }
    getchar();
  }
  int sr, sc, er, ec;
  scanf("%d %d %d %d", &sc, &sr, &ec, &er);
  sr--;
  sc--;
  er--;
  ec--;
  map[sc][sr] = '.';
  int result = walk(sr, sc, er, ec, map);
  if (result == 1) {
    printf("YES");
  } else {
    printf("NO");
  }
  return (0);
}
int walk(int sr, int sc, int er, int ec, char** map) {
  if (sc >= m || sr >= n || sc < 0 || sr < 0) {
    return (0);
  }
  if (sc == ec && sr == er && map[sc][sr] == 'X') {
    return (1);
  }
  if (map[sc][sr] == 'X') {
    return (0);
  }
  map[sc][sr] = 'X';
  return (walk(sr, sc + 1, er, ec, map) || walk(sr + 1, sc, er, ec, map) ||
          walk(sr - 1, sc, er, ec, map) || walk(sr, sc - 1, er, ec, map));
}
void print(char** map) {
  int i, j;
  for (i = 0; i < m; i++) {
    for (j = 0; j < n; j++) {
      printf("%c", map[i][j]);
    }
    printf("\n");
  }
}
