#include <bits/stdc++.h>
using namespace std;
list<int> a[260000];
char mass[260000];
int f[260000];
int n, m, x1, y, x2, y2, pos1, pos2;
void dfs(int v) {
  f[v] = 1;
  while (!a[v].empty()) {
    if (f[a[v].front()] == 0) dfs(a[v].front());
    a[v].pop_front();
  }
}
int main() {
  cin >> n >> m;
  char c;
  int pos = 0;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      cin >> c;
      mass[pos] = c;
      pos++;
    }
  }
  cin >> x1 >> y >> x2 >> y2;
  pos1 = (x1 - 1) * m - 1 + y;
  pos2 = (x2 - 1) * m - 1 + y2;
  int sum = 0;
  if (pos1 != pos2) {
    mass[pos1] = '.';
  }
  if (x2 > 0 && mass[pos2 - m] == '.') {
    sum++;
  }
  if (y2 > 1 && mass[pos2 - 1] == '.') {
    sum++;
  }
  if (y2 < m && mass[pos2 + 1] == '.') {
    sum++;
  }
  if (x2 < n && mass[pos2 + m] == '.') {
    sum++;
  }
  if (mass[pos2] == '.') {
    if (sum < 2) {
      cout << "NO";
      return 0;
    }
  }
  if (pos1 == pos2 && sum < 1) {
    cout << "NO";
    return 0;
  }
  if (pos1 == pos2) {
    mass[pos1] = '.';
  }
  mass[pos2] = '.';
  pos = 0;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if (mass[pos] == '.') {
        if (j > 0 && mass[pos - 1] == '.') {
          a[pos - 1].push_front(pos);
          a[pos].push_front(pos - 1);
        }
        if (i > 0 && mass[pos - m] == '.') {
          a[pos - m].push_front(pos);
          a[pos].push_front(pos - m);
        }
      }
      pos++;
    }
  }
  dfs(pos1);
  if (f[pos2] == 1) {
    cout << "YES";
  } else {
    cout << "NO";
  }
  return 0;
}
