#include <bits/stdc++.h>
using namespace std;
int nr, 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 ok(int x, int y) { return (x >= 1 && y >= 1 && x <= N && y <= M); }
void bfs(int x, int y, int xx, int yy) {
  viz[x][y] = 1;
  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 (ok(nx, ny) && !viz[nx][ny] && a[nx][ny] == 2) {
        viz[nx][ny] = 1;
        Q.push(make_pair(nx, ny));
      }
    }
  }
}
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 (r1 == r2 && c1 == c2) {
    for (int i = 0; i < 4; ++i) {
      int nx = r2 + dx[i], ny = c2 + dy[i];
      if (a[nx][ny] == 2) ++nr;
    }
    if (nr >= 1)
      cout << "YES";
    else
      cout << "NO";
    return 0;
  }
  for (int i = 0; i < 4; ++i) {
    int nx = r1 + dx[i], ny = c1 + dy[i];
    if (nx == r2 && ny == c2) {
      if (a[nx][ny] == 1) {
        cout << "YES";
        return 0;
      }
      for (int k = 0; k < 4; ++k) {
        int nxx = r2 + dx[k], nyy = c2 + dy[k];
        if (a[nxx][nyy] == 2) {
          cout << "YES";
          return 0;
        }
      }
      cout << "NO";
      return 0;
    }
  }
  bfs(r1, c1, r2, c2);
  if (a[r2][c2] == 1) {
    for (int i = 0; i < 4; ++i) {
      int nx = r2 + dx[i], ny = c2 + dy[i];
      if (a[nx][ny] == 2 && viz[nx][ny]) ++nr;
    }
    if (nr >= 1)
      cout << "YES";
    else
      cout << "NO";
    return 0;
  }
  if (!viz[r2][c2]) {
    cout << "NO";
    return 0;
  }
  for (int i = 0; i < 4; ++i) {
    int nx = r2 + dx[i], ny = c2 + dy[i];
    if (a[nx][ny] == 2) ++nr;
  }
  if (nr < 2) {
    cout << "NO";
    return 0;
  }
  cout << "YES";
  return 0;
}
