#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  vector<vector<char> > ar(n, vector<char>(m));
  vector<vector<bool> > visited(n, vector<bool>(m));
  for (long long i = 0; i < n; i++) {
    for (long long j = 0; j < m; j++) {
      cin >> ar[i][j];
    }
  }
  int a, b, u, v;
  cin >> a >> b >> u >> v;
  --a;
  --b;
  --u;
  --v;
  visited[a][b] = true;
  deque<pair<long long, long long> > Q;
  Q.push_back(pair<long long, long long>(a, b));
  while (!Q.empty()) {
    int x = Q.front().first;
    int y = Q.front().second;
    Q.pop_front();
    if (x == u && y == v) {
      break;
    }
    if (x + 1 < n && !visited[x + 1][y] &&
        (ar[x + 1][y] != 'X' || (x + 1 == u && y == v))) {
      Q.push_back(pair<long long, long long>(x + 1, y));
      visited[x + 1][y] = true;
    }
    if (x - 1 >= 0 && !visited[x - 1][y] &&
        (ar[x - 1][y] != 'X' || (x - 1 == u && y == v))) {
      Q.push_back(pair<long long, long long>(x - 1, y));
      visited[x - 1][y] = true;
    }
    if (y + 1 < m && !visited[x][y + 1] &&
        (ar[x][y + 1] != 'X' || (x == u && y + 1 == v))) {
      Q.push_back(pair<long long, long long>(x, y + 1));
      visited[x][y + 1] = true;
    }
    if (y - 1 >= 0 && !visited[x][y - 1] &&
        (ar[x][y - 1] != 'X' || (x == u && y - 1 == v))) {
      Q.push_back(pair<long long, long long>(x, y - 1));
      visited[x][y - 1] = true;
    }
  }
  if (visited[u][v]) {
    if (ar[u][v] == 'X' && !(a == u && b == v)) {
      cout << "YES" << endl;
    } else {
      int free = 0;
      if (u - 1 >= 0) free += (ar[u - 1][v] == '.' || (u - 1 == a && v == b));
      if (u + 1 < n) free += (ar[u + 1][v] == '.' || (u + 1 == a && v == b));
      if (v - 1 >= 0) free += (ar[u][v - 1] == '.' || (v - 1 == b && u == a));
      if (v + 1 < m) free += (ar[u][v + 1] == '.' || (v + 1 == b && u == a));
      if (free >= 2 || (a == u && b == v && free >= 1))
        cout << "YES" << endl;
      else
        cout << "NO" << endl;
    }
  } else
    cout << "NO" << endl;
}
