#include <bits/stdc++.h>
using namespace std;
int n, m, a, b, c, d;
vector<vector<bool> > v;
vector<vector<bool> > ehmhulyevagyok;
vector<vector<vector<pair<int, int> > > > g;
vector<vector<int> > s;
bool jo;
void dfs(int x, int y) {
  v[x][y] = true;
  if (x == c && y == d) {
    jo = true;
    return;
  }
  for (pair<int, int> p : g[x][y]) {
    if (!v[p.first][p.second] || (p.first == c && p.second == d)) {
      dfs(p.first, p.second);
    }
  }
}
int main() {
  cin >> n >> m;
  v.assign(2 + n, vector<bool>(2 + m));
  g.assign(2 + n, vector<vector<pair<int, int> > >(2 + m));
  s.assign(2 + n, vector<int>(2 + m, 0));
  for (int i = 0; i <= n + 1; ++i) {
    v[i][0] = 1;
    v[i][m + 1] = 1;
  }
  for (int j = 0; j <= m + 1; ++j) {
    v[0][j] = 1;
    v[n + 1][j] = 1;
  }
  char ch;
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= m; ++j) {
      cin >> ch;
      if (ch == '.') {
        v[i][j] = 0;
      } else {
        v[i][j] = 1;
      }
    }
  }
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= m; ++j) {
      g[i][j].push_back({i, j + 1});
      g[i][j].push_back({i, j - 1});
      g[i][j].push_back({i + 1, j});
      g[i][j].push_back({i - 1, j});
      if (!v[i - 1][j]) ++s[i][j];
      if (!v[i + 1][j]) ++s[i][j];
      if (!v[i][j + 1]) ++s[i][j];
      if (!v[i][j - 1]) ++s[i][j];
    }
  }
  cin >> a >> b >> c >> d;
  s[a][b + 1]++;
  s[a + 1][b]++;
  s[a - 1][b]++;
  s[a][b - 1]++;
  ehmhulyevagyok = v;
  dfs(a, b);
  if (!jo) {
    cout << "NO\n";
  } else if (c == a && d == b) {
    if (s[c][d] >= 1) {
      cout << "YES\n";
    } else {
      cout << "NO\n";
    }
  } else if (ehmhulyevagyok[c][d]) {
    cout << "YES\n";
  } else {
    if (s[c][d] >= 2) {
      cout << "YES\n";
    } else {
      cout << "NO\n";
    }
  }
  return 0;
}
