#include <bits/stdc++.h>
const int maxn = 501;
long long inf = 1LL << 60;
using namespace std;
inline void read(int &n) {
  int x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = 10 * x + ch - '0';
    ch = getchar();
  }
  n = x * f;
}
inline void read(long long &n) {
  long long x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = 10ll * x + ch - '0';
    ch = getchar();
  }
  n = x * f;
}
int a[maxn][maxn];
int main() {
  ios_base::sync_with_stdio(0);
  int n, m;
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      char t;
      cin >> t;
      if (t == '.') a[i][j] = 1;
    }
  }
  int r1, c1;
  cin >> r1 >> c1;
  r1--, c1--;
  int r2, c2;
  cin >> r2 >> c2;
  r2--, c2--;
  int count = 0;
  pair<int, int> now = {r2, c2};
  if (now.first + 1 < n && a[now.first + 1][now.second]) count++;
  if (now.first - 1 >= 0 && a[now.first - 1][now.second]) count++;
  if (now.second + 1 < m && a[now.first][now.second + 1]) count++;
  if (now.second - 1 >= 0 && a[now.first][now.second - 1]) count++;
  if (r1 == r2 && c1 == c2) {
    if (count)
      puts("YES");
    else
      puts("NO");
    return 0;
  }
  queue<pair<int, int> > q;
  q.push({r1, c1});
  bool f = a[r2][c2];
  a[r2][c2] = 1;
  while (!q.empty()) {
    now = q.front();
    q.pop();
    if (now.first == r2 && now.second == c2) {
      if (!f) {
        puts("YES");
        return 0;
      }
      if (f && count >= 2) {
        puts("YES");
        return 0;
      }
      if (r1 + 1 == r2 && c1 == c2 && count) {
        puts("YES");
        return 0;
      }
      if (r1 - 1 == r2 && c1 == c2 && count) {
        puts("YES");
        return 0;
      }
      if (r1 == r2 && c1 + 1 == c2 && count) {
        puts("YES");
        return 0;
      }
      if (r1 == r2 && c1 - 1 == c2 && count) {
        puts("YES");
        return 0;
      }
    }
    if (now.first + 1 < n && a[now.first + 1][now.second]) {
      a[now.first + 1][now.second] = 0;
      q.push({now.first + 1, now.second});
    }
    if (now.first - 1 >= 0 && a[now.first - 1][now.second]) {
      a[now.first - 1][now.second] = 0;
      q.push({now.first - 1, now.second});
    }
    if (now.second + 1 < m && a[now.first][now.second + 1]) {
      a[now.first][now.second + 1] = 0;
      q.push({now.first, now.second + 1});
    }
    if (now.second - 1 >= 0 && a[now.first][now.second - 1]) {
      a[now.first][now.second - 1] = 0;
      q.push({now.first, now.second - 1});
    }
  }
  puts("NO");
  return 0;
}
