#include <bits/stdc++.h>
using namespace std;
char A[501][501];
int d1[4] = {0, 0, 1, -1};
int d2[4] = {-1, 1, 0, 0};
int r1, c1, r2, c2;
bool dfs(int l, int k) {
  if (A[l][k] != '.') {
    if (l == r2 && k == c2) return 1;
    return 0;
  }
  A[l][k] = 'X';
  for (int h = 0; h < 4; h++)
    if (dfs(l + d1[h], k + d2[h])) return 1;
  return 0;
}
int main() {
  int n, m;
  cin >> n >> m;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= m; j++) cin >> A[i][j];
  cin >> r1 >> c1;
  cin >> r2 >> c2;
  A[r1][c1] = '.';
  if (dfs(r1, c1))
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
  return 0;
}
