#include <bits/stdc++.h>
using namespace std;
bool valid(int x, int y, int n, int m) {
  return (x >= 0 && y >= 0 && x < n && y < m);
}
int main() {
  int n, m, i, x1, y1, x2, y2, x, y, cnt, top;
  cin >> n >> m;
  string a[n];
  for (i = 0; i < n; i++) cin >> a[i];
  cin >> x1 >> y1 >> x2 >> y2;
  x1--;
  y1--;
  x2--;
  y2--;
  if (x1 == x2 && y1 == y2) {
    cnt = 0;
    x = x1;
    y = y1;
    if (valid(x - 1, y, n, m) && a[x - 1][y] == '.') cnt++;
    if (valid(x + 1, y, n, m) && a[x + 1][y] == '.') cnt++;
    if (valid(x, y - 1, n, m) && a[x][y - 1] == '.') cnt++;
    if (valid(x, y + 1, n, m) && a[x][y + 1] == '.') cnt++;
    if (a[x1][y1] != '.' && cnt)
      cout << "YES" << endl;
    else if (a[x1][y1] == '.' && cnt > 1)
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
    return 0;
  }
  char ch = a[x2][y2];
  a[x2][y2] = '.';
  vector<pair<int, int> > v;
  int mrk[n][m];
  memset(mrk, 0, sizeof(mrk));
  v.push_back(make_pair(x1, y1));
  mrk[x1][y1] = 1;
  top = 0;
  while (top != v.size()) {
    x = v[top].first;
    y = v[top].second;
    top++;
    if (x == x2 && y == y2) {
      if (ch != '.') {
        cout << "YES" << endl;
        return 0;
      }
      cnt = 0;
      if (valid(x - 1, y, n, m) && a[x - 1][y] == '.')
        cnt++;
      else if (x - 1 == x1 && y == y1)
        cnt++;
      if (valid(x + 1, y, n, m) && a[x + 1][y] == '.')
        cnt++;
      else if (x + 1 == x1 && y == y1)
        cnt++;
      if (valid(x, y - 1, n, m) && a[x][y - 1] == '.')
        cnt++;
      else if (x == x1 && y - 1 == y1)
        cnt++;
      if (valid(x, y + 1, n, m) && a[x][y + 1] == '.')
        cnt++;
      else if (x == x1 && y + 1 == y1)
        cnt++;
      if (cnt > 1)
        cout << "YES" << endl;
      else
        cout << "NO" << endl;
      return 0;
    }
    if (valid(x - 1, y, n, m) && a[x - 1][y] == '.' && !mrk[x - 1][y]) {
      mrk[x - 1][y] = 1;
      v.push_back(make_pair(x - 1, y));
    }
    if (valid(x + 1, y, n, m) && a[x + 1][y] == '.' && !mrk[x + 1][y]) {
      mrk[x + 1][y] = 1;
      v.push_back(make_pair(x + 1, y));
    }
    if (valid(x, y - 1, n, m) && a[x][y - 1] == '.' && !mrk[x][y - 1]) {
      mrk[x][y - 1] = 1;
      v.push_back(make_pair(x, y - 1));
    }
    if (valid(x, y + 1, n, m) && a[x][y + 1] == '.' && !mrk[x][y + 1]) {
      mrk[x][y + 1] = 1;
      v.push_back(make_pair(x, y + 1));
    }
  }
  cout << "NO" << endl;
  return 0;
}
