#include <bits/stdc++.h>
using namespace std;
int n, m, sX, sY, gX, gY;
int vis[600][600];
int dX[4] = {1, 0, -1, 0};
int dY[4] = {0, 1, 0, -1};
bool inside(int x, int y) { return (x >= 0 && x < n && y >= 0 && y < m); }
bool DFS(int curX, int curY) {
  bool res = false;
  for (int k = 0; k < 4; ++k) {
    int u = curX + dX[k];
    int v = curY + dY[k];
    if (inside(u, v)) {
      if (vis[u][v] == 1) {
        if (u == gX && v == gY) return true;
      } else if (!vis[u][v]) {
        vis[u][v]++;
        res |= DFS(u, v);
        if (res) return res;
      }
    }
  }
  return res;
}
int main() {
  memset(vis, 0, sizeof(vis));
  cin >> n >> m;
  for (int i = 0; i < n; ++i) {
    string line;
    cin >> line;
    for (int j = 0; j < m; ++j) {
      if (line[j] == '.')
        vis[i][j] = 0;
      else
        vis[i][j] = 1;
    }
  }
  cin >> sX >> sY >> gX >> gY;
  sX--;
  sY--;
  gX--;
  gY--;
  if (DFS(sX, sY)) {
    cout << "YES";
  } else
    cout << "NO";
  return 0;
}
