#include <bits/stdc++.h>
using namespace std;
int n, m, si, sj, ei, ej;
string mp[506];
int vis[506][506];
int dx[] = {0, 0, -1, 1};
int dy[] = {-1, 1, 0, 0};
int flag, X;
bool check(int x, int y) {
  if (x >= 0 && x < n && y >= 0 && y < m)
    return true;
  else
    return false;
}
int count() {
  int i, tx, ty, res = 0;
  for (i = 0; i < 4; i++) {
    tx = ei + dx[i];
    ty = ej + dy[i];
    if (vis[tx][ty] == 0 && check(tx, ty)) res++;
  }
  return res;
}
void dfs(int x, int y) {
  stack<int> q;
  q.push(si);
  q.push(sj);
  while (!q.empty()) {
    int y = q.top();
    q.pop();
    int x = q.top();
    q.pop();
    vis[x][y] = 1;
    for (int i = 0; i < 4; i++) {
      int ti = x + dx[i];
      int tj = y + dy[i];
      if (check(ti, tj)) {
        if (ti == ei && tj == ej) {
          if (vis[ei][ej]) {
            flag = 1;
            return;
          } else {
            if (count() >= 1) {
              flag = 1;
              return;
            }
          }
        } else if (!vis[ti][tj]) {
          q.push(ti);
          q.push(tj);
        }
      }
    }
  }
}
int main() {
  while (~scanf("%d%d", &n, &m)) {
    int i, j;
    for (i = 0; i < n; i++) cin >> mp[i];
    for (i = 0; i < n; i++) {
      for (j = 0; j < m; j++) {
        if (mp[i][j] == '.')
          vis[i][j] = 0;
        else
          vis[i][j] = 1;
      }
    }
    X = 0;
    scanf("%d%d%d%d", &si, &sj, &ei, &ej);
    si--;
    sj--;
    ei--;
    ej--;
    if (vis[ei][ej]) X = 1;
    if (si == ei && sj == ej && count()) {
      printf("YES\n");
      continue;
    }
    flag = 0;
    dfs(si, sj);
    if (flag)
      printf("YES\n");
    else
      printf("NO\n");
  }
}
