#include <bits/stdc++.h>
using namespace std;
int n, m, sx, sy, dx, dy, ans;
char grid[505][505];
int X[] = {1, -1, 0, 0, -1, -1, 1, 1};
int Y[] = {0, 0, 1, -1, -1, 1, -1, 1};
bool valid(int i, int j) { return i >= 0 && i < n && j >= 0 && j < m; }
void dfs(int x, int y) {
  for (int i = 0; i < 4; i++) {
    int nx = x + X[i];
    int ny = y + Y[i];
    if (valid(nx, ny) && grid[nx][ny] == '.') {
      grid[nx][ny] = 'X';
      dfs(nx, ny);
    } else if (nx == dx - 1 && ny == dy - 1) {
      ans = 1;
      return;
    }
  }
}
int main() {
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      cin >> grid[i][j];
    }
  }
  cin >> sx >> sy >> dx >> dy;
  dfs(sx - 1, sy - 1);
  if (ans)
    cout << "YES";
  else
    cout << "NO";
}
