#include <bits/stdc++.h>
using namespace std;
int r1, c1, r2, c2, a[505][505], N, M, dx[4] = {-1, 0, 1, 0},
                                       dy[4] = {0, 1, 0, -1};
bool viz[505][505];
char c;
queue<pair<int, int> > Q;
bool bfs(int x, int y, int xx, int yy) {
  Q.push(make_pair(x, y));
  while (Q.size()) {
    pair<int, int> nod = Q.front();
    Q.pop();
    for (int i = 0; i < 4; ++i) {
      int nx = nod.first + dx[i], ny = nod.second + dy[i];
      if (a[nx][ny] == 1 && nx == xx && ny == yy) {
        return 1;
      } else if (a[nx][ny] == 2) {
        --a[nx][ny];
        Q.push(make_pair(nx, ny));
      }
    }
  }
  return 0;
}
int main() {
  cin.sync_with_stdio(false);
  cin >> N >> M;
  for (int i = 1; i <= N; ++i)
    for (int j = 1; j <= M; ++j) {
      cin >> c;
      if (c == '.')
        a[i][j] = 2;
      else
        a[i][j] = 1;
    }
  cin >> r1 >> c1 >> r2 >> c2;
  if (bfs(r1, c1, r2, c2))
    cout << "YES";
  else
    cout << "NO";
  return 0;
}
