#include <bits/stdc++.h>
using namespace std;
int a[501][501];
char s[501];
int startx, starty, endx, endy;
int n, m;
int asd(int x, int y) {
  if (x == endx && y == endy && a[x][y]) return 1;
  if (a[x][y]) return 0;
  a[x][y] = 1;
  if (x > 1)
    if (asd(x - 1, y)) return 1;
  if (y > 1)
    if (asd(x, y - 1)) return 1;
  if (x < n)
    if (asd(x + 1, y)) return 1;
  if (y < m)
    if (asd(x, y + 1)) return 1;
  return 0;
}
int main() {
  while (cin >> n >> m) {
    int i, j;
    for (i = 1; i <= n; i++) {
      cin >> s;
      for (j = 0; j < m; j++) a[i][j + 1] = s[j] == 'X' ? 1 : 0;
    }
    cin >> startx >> starty >> endx >> endy;
    a[startx][starty] = 0;
    if (asd(startx, starty))
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  }
  return 0;
}
