#include <bits/stdc++.h>
using namespace std;
char grid[510][510];
int n, m;
int SR, SC, DR, DC;
bool valid(int row, int col) {
  if (row == n + 1 || row == 0 || col == 0 || col == m + 1 ||
      grid[row][col] == 'X')
    return false;
  return true;
}
bool dfs(int row, int col) {
  if (row == DR && col == DC && grid[row][col] == 'X') return true;
  if (!valid(row, col)) return false;
  bool left, right, up, down;
  grid[row][col] = 'X';
  right = dfs(row, col + 1);
  left = dfs(row, col - 1);
  down = dfs(row + 1, col);
  up = dfs(row - 1, col);
  if (up || down || right || left)
    return true;
  else {
    return false;
  }
}
int main() {
  bool ans;
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) cin >> grid[i][j];
  }
  cin >> SR >> SC >> DR >> DC;
  grid[SR][SC] = '.';
  ans = dfs(SR, SC);
  if (ans)
    cout << "YES";
  else
    cout << "NO";
  return 0;
}
