#include <bits/stdc++.h>
using namespace std;
bool d[502][502];
bool repedt[502][502];
void f(int, int);
int main() {
  int n, m, r1, r2, c1, c2;
  cin >> n >> m;
  for (int i = 0; i < n + 2; i++) {
    for (int j = 0; j < m + 2; j++) {
      d[i][j] = false;
      repedt[i][j] = true;
    }
  }
  string s;
  for (int i = 1; i <= n; i++) {
    cin >> s;
    for (int j = 1; j <= m; j++) {
      if (s[j - 1] == '.') repedt[i][j] = false;
    }
  }
  cin >> r1 >> c1;
  cin >> r2 >> c2;
  if (r1 == r2 && c1 == c2)
    ;
  else {
    d[r1][c1] = true;
    repedt[r1][c1] = false;
  }
  f(r1, c1);
  if (repedt[r2][c2] == true) {
    if (d[r2][c2 - 1] == true || d[r2][c2 + 1] == true ||
        d[r2 - 1][c2] == true || d[r2 + 1][c2] == true) {
      cout << "YES";
    } else {
      cout << "NO";
    }
  } else {
    if (d[r2][c2] == true) {
      int db = 0;
      if (!repedt[r2][c2 + 1]) db++;
      if (!repedt[r2][c2 - 1]) db++;
      if (!repedt[r2 + 1][c2]) db++;
      if (!repedt[r2 - 1][c2]) db++;
      if (db > 1)
        cout << "YES";
      else
        cout << "NO";
    } else
      cout << "NO";
  }
}
void f(int x, int y) {
  if (repedt[x][y - 1] == false && d[x][y - 1] == false) {
    d[x][y - 1] = true;
    f(x, y - 1);
  }
  if (repedt[x][y + 1] == false && d[x][y + 1] == false) {
    d[x][y + 1] = true;
    f(x, y + 1);
  }
  if (repedt[x - 1][y] == false && d[x - 1][y] == false) {
    d[x - 1][y] = true;
    f(x - 1, y);
  }
  if (repedt[x + 1][y] == false && d[x + 1][y] == false) {
    d[x + 1][y] = true;
    f(x + 1, y);
  }
}
