#include <bits/stdc++.h>
using namespace std;
char grid[502][502];
int n, m, r1, c1, r2, c2;
bool K;
void dfs(int x, int y) {
  if (x == r2 && y == c2) {
    if (grid[x][y] == 'X') {
      K = 1;
      return;
    }
  }
  if (grid[x][y] == 'X' || y <= 0 || x <= 0 || y > m || x > n) return;
  grid[x][y] = 'X';
  dfs(x, y + 1);
  dfs(x, y - 1);
  dfs(x + 1, y);
  dfs(x - 1, y);
}
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 << (K ? "YES" : "NO");
}
