#include <bits/stdc++.h>
using namespace std;
int n, m, u, w, a, b, x2, y2, sur[4][2] = {{-1, 0}, {0, -1}, {0, 1}, {1, 0}};
bool there;
char arr[505][505];
bool valid(int x, int y) {
  return ((x > -1) && (x < n) && (y > -1) && (y < m));
}
void dfs(int i, int j) {
  for (int k = 0; k < 4; k++) {
    w = i + sur[k][0], u = j + sur[k][1];
    if (valid(w, u)) {
      if (w == x2 && u == y2) {
        if (arr[w][u] == 'X') {
          there = 1;
          return;
        }
        arr[w][u] = 'X';
        dfs(w, u);
      } else {
        if (arr[w][u] == '.') {
          arr[w][u] = 'X';
          dfs(w, u);
        }
      }
    }
  }
}
int main() {
  ios_base::sync_with_stdio();
  cin.tie(0);
  cout.tie(0);
  cin >> n >> m;
  for (int i = 0; i < n; i++) cin >> arr[i];
  cin >> a >> b >> x2 >> y2;
  a--, b--, x2--, y2--;
  dfs(a, b);
  there ? cout << "YES\n" : cout << "NO\n";
  return 0;
}
