#include <bits/stdc++.h>
using namespace std;
char cell[501][501];
int r1, c1;
int r2, c2;
int n, m;
inline bool canJump2(int r, int c) {
  return r >= 1 && c >= 1 && r <= n && c <= m && cell[r][c] == '.';
}
inline bool isEndCell(int r, int c) { return r == r2 && c == c2; }
bool jumpFrom(int r, int c, int dir) {
  int r_2 = r, c_2 = c;
  switch (dir) {
    case 1:
      c_2--;
      break;
    case 2:
      c_2++;
      break;
    case 3:
      r_2--;
      break;
    case 4:
      r_2++;
      break;
    default:
      return false;
  }
  bool rt = false;
  if (canJump2(r_2, c_2)) {
    cell[r_2][c_2] = 'X';
    rt = jumpFrom(r_2, c_2, 1);
  } else if (isEndCell(r_2, c_2)) {
    return true;
  }
  if (!rt) {
    rt = jumpFrom(r, c, ++dir);
  }
  return rt;
}
int main() {
  cin >> n >> m;
  char ch = 0;
  for (int r = 1; r <= n; r++) {
    for (int c = 1; c <= m; c++) {
      ch = cin.get();
      while (ch != '.' && ch != 'X') {
        ch = cin.get();
      }
      cell[r][c] = ch;
    }
  }
  cin >> r1 >> c1;
  cin >> r2 >> c2;
  bool done = jumpFrom(r1, c1, 1);
  cout << (done ? "YES" : "NO");
  return 0;
}
