#include <bits/stdc++.h>
using namespace std;
int n, m;
char s[600][600];
int nextt[4][2] = {0, 1, 1, 0, 0, -1, -1, 0};
int book[600][600];
int k1, k2, k3, k4;
struct node {
  int x, y, step;
};
int bfs(int a, int b) {
  queue<node> q;
  node now, temp;
  now.x = a;
  now.y = b;
  now.step = 0;
  q.push(now);
  while (!q.empty()) {
    now = q.front();
    q.pop();
    for (int i = 0; i < 4; i++) {
      int tx = now.x + nextt[i][0];
      int ty = now.y + nextt[i][1];
      if (tx < 1 || tx > n || ty < 1 || ty > m) continue;
      if (tx == k3 && ty == k4 && book[tx][ty] == 1) return 1;
      if (book[tx][ty] == 2) {
        temp.x = tx;
        temp.y = ty;
        temp.step = now.step + 1;
        book[tx][ty]--;
        q.push(temp);
      }
    }
  }
  return 0;
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) {
    scanf("%s", s[i] + 1);
    for (int j = 1; j <= m; j++) {
      if (s[i][j] == '.')
        book[i][j] = 2;
      else
        book[i][j] = 1;
    }
  }
  scanf("%d%d%d%d", &k1, &k2, &k3, &k4);
  int f = bfs(k1, k2);
  if (f)
    printf("YES\n");
  else
    printf("NO\n");
}
