#include <bits/stdc++.h>
const int N = 505;
char mp[N][N];
int n, m;
int r2, c2;
bool dfs(int r, int c) {
  if (r == r2 && c == c2 && mp[r][c] == 'X') return true;
  if (mp[r][c] == 'X') return false;
  mp[r][c] = 'X';
  if (r + 1 > 0 && r + 1 <= n && c > 0 && c <= m && dfs(r + 1, c)) return true;
  ;
  if (r - 1 > 0 && r - 1 <= n && c > 0 && c <= m && dfs(r - 1, c)) return true;
  ;
  if (r > 0 && r <= n && c + 1 > 0 && c + 1 <= m && dfs(r, c + 1)) return true;
  ;
  if (r > 0 && r <= n && c - 1 > 0 && c - 1 <= m && dfs(r, c - 1)) return true;
  ;
  return false;
}
bool solve(int r, int c) {
  if (r + 1 > 0 && r + 1 <= n && c > 0 && c <= m && dfs(r + 1, c)) return true;
  ;
  if (r - 1 > 0 && r - 1 <= n && c > 0 && c <= m && dfs(r - 1, c)) return true;
  ;
  if (r > 0 && r <= n && c + 1 > 0 && c + 1 <= m && dfs(r, c + 1)) return true;
  ;
  if (r > 0 && r <= n && c - 1 > 0 && c - 1 <= m && dfs(r, c - 1)) return true;
  ;
  return false;
}
int main() {
  while (~scanf("%d%d", &n, &m)) {
    for (int i = 1; i <= n; i++) scanf("%s", mp[i] + 1);
    int r1, c1;
    scanf("%d%d%d%d", &r1, &c1, &r2, &c2);
    puts(solve(r1, c1) ? "YES" : "NO");
  }
  return 0;
}
