#include <bits/stdc++.h>
using namespace std;
const int N = 503;
char grid[N][N];
int n, m, r1, c1, r2, c2;
bool dfs(int r, int c) {
  if (grid[r][c] != '.') {
    if (r == r2 && c == c2) return 1;
    return 0;
  }
  grid[r][c] = 'X';
  if (dfs(r + 1, c)) return 1;
  if (dfs(r - 1, c)) return 1;
  if (dfs(r, c - 1)) return 1;
  if (dfs(r, c + 1)) return 1;
  return 0;
}
int main() {
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      cin >> grid[i][j];
    }
  }
  cin >> r1 >> c1 >> r2 >> c2;
  grid[r1][c1] = '.';
  (dfs(r1, c1)) ? cout << "YES" : cout << "NO";
  return 0;
}
