#include <bits/stdc++.h>
using namespace std;
vector<string> G;
bool vis[505][505];
int n, m;
bool dfs(int si, int sj, int ei, int ej) {
  bool ok = (si == ei and sj == ej);
  for (int i = -1; i <= 1; i++)
    for (int j = -1; j <= 1; j++)
      if (abs(i) == abs(j))
        continue;
      else
        ok |= (si + i == ei and sj + j == ej);
  if (ok) return 1;
  vis[si][sj] = 1;
  bool ret = 0;
  for (int i = -1; i <= 1; i++)
    for (int j = -1; j <= 1; j++) {
      if (abs(i) == abs(j)) continue;
      if ((i + si < 0) || (i + si >= n) || (sj + j < 0) || (sj + j >= m))
        continue;
      else {
        if ((G[i + si][j + sj] != 'X') and (!vis[i + si][j + sj]))
          ret |= dfs(i + si, j + sj, ei, ej);
      }
    }
  return ret;
}
int main() {
  cin >> n >> m;
  if (n == 1 and m == 1) {
    puts("NO");
    return 0;
  }
  G.resize(n);
  for (int i = 0; i < n; i++) cin >> G[i];
  int si, sj, ei, ej;
  cin >> si >> sj >> ei >> ej;
  si--, sj--, ei--, ej--;
  memset(vis, 0, sizeof vis);
  if (si == ei and sj == ej) {
    int cnt = 0;
    for (int i = -1; i <= 1; i++)
      for (int j = -1; j <= 1; j++)
        if (abs(i) == abs(j))
          continue;
        else {
          if (i + ei >= 0 and i + ei < n and j + ej >= 0 and j + ej < m)
            cnt += G[i + ei][j + ej] == '.';
        }
    if (cnt)
      puts("YES");
    else
      puts("NO");
    return 0;
  }
  if (G[ei][ej] == 'X') {
    bool ok = dfs(si, sj, ei, ej);
    if (ok)
      puts("YES");
    else
      puts("NO");
  } else {
    int cnt = 0;
    for (int i = -1; i <= 1; i++)
      for (int j = -1; j <= 1; j++)
        if (abs(i) == abs(j))
          continue;
        else {
          if (ei + i < 0 or ei + i >= n or ej + j < 0 or ej + j >= m)
            continue;
          else if (G[ei + i][ej + j] == '.') {
            memset(vis, 0, sizeof vis);
            G[ei + i][ej + j] = 'X';
            cnt += dfs(si, sj, ei, ej);
            G[ei + i][ej + j] = '.';
          }
        }
    if (cnt > 0)
      puts("YES");
    else
      puts("NO");
  }
}
