#include <bits/stdc++.h>
using namespace std;
const int N = 503;
const int dx[4] = {1, -1, 0, 0};
const int dy[4] = {0, 0, 1, -1};
int n, m;
int x_1, x_2, y_1, y_2;
bool a[N][N], v[N][N];
bool has;
void dfs(int x, int y) {
  v[x][y] = true;
  for (int k = 0; k < 4; k++) {
    int nx = x + dx[k], ny = y + dy[k];
    if (a[nx][ny] && !v[nx][ny]) dfs(nx, ny);
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= m; j++) {
      char c;
      cin >> c;
      a[i][j] = (c == '.');
    }
  }
  cin >> x_1 >> y_1;
  cin >> x_2 >> y_2;
  if (x_1 == x_2 && y_1 == y_2) {
    int cnt = 0;
    for (int k = 0; k < 4; k++) {
      int nx = x_2 + dx[k], ny = y_2 + dy[k];
      if (a[nx][ny]) cnt++;
    }
    if (cnt >= 1)
      cout << "YES";
    else
      cout << "NO";
    return 0;
  }
  a[x_1][y_1] = true;
  if (a[x_2][y_2]) {
    dfs(x_1, y_1);
    if (v[x_2][y_2]) {
      int cnt = 0;
      for (int k = 0; k < 4; k++) {
        int nx = x_2 + dx[k], ny = y_2 + dy[k];
        if (a[nx][ny]) cnt++;
      }
      if (cnt >= 2)
        cout << "YES";
      else
        cout << "NO";
    } else {
      cout << "NO";
    }
  } else {
    a[x_2][y_2] = true;
    dfs(x_1, y_1);
    if (v[x_2][y_2])
      cout << "YES";
    else
      cout << "NO";
  }
  return 0;
}
