#include <bits/stdc++.h>
using namespace std;
char ch[502][502];
int r1, c1, r2, c2, n, m;
void dfs(int x, int y) {
  ++ch[x][y];
  if (ch[x][y] >= 3 || x <= 0 || y <= 0 || x > n || y > m) return;
  dfs(x + 1, y);
  dfs(x - 1, y);
  dfs(x, y + 1);
  dfs(x, y - 1);
}
int main() {
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      char f;
      cin >> f;
      if (f == '.') {
        ++ch[i][j];
      } else {
        ch[i][j] += 2;
      }
    }
  }
  cin >> r1 >> c1 >> r2 >> c2;
  ch[r1][c1] = 1;
  dfs(r1, c1);
  if (ch[r2][c2] >= 3)
    cout << "YES";
  else {
    cout << "NO";
  }
  return 0;
}
