#include <bits/stdc++.h>
using namespace std;
const long long dx[] = {0, 0, -1, 1}, dy[] = {1, -1, 0, 0};
long long m, n, bx, by, ex, ey, visited[505][505];
template <typename tn>
inline tn next(void);
template <typename tn>
inline ostream& operator<<(ostream& os, const vector<tn>& v);
string s[505];
inline void dfs(long long nx, long long ny) {
  visited[nx][ny] = 1;
  for (long long i = 0; i < 4; i++) {
    long long fx = nx + dx[i], fy = ny + dy[i];
    if (fx == ex && fy == ey) puts("YES"), exit(0);
    if (fx < 0 || fx >= m || fy < 0 || fy >= n || s[fx][fy] == 'X' ||
        visited[fx][fy])
      continue;
    dfs(fx, fy);
  }
}
signed main(void) {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> m >> n;
  for (long long i = 0; i < m; i++) cin >> s[i];
  cin >> bx >> by >> ex >> ey;
  bx--;
  by--;
  ex--;
  ey--;
  if (s[ex][ey] == '.') {
    long long cnt = 0;
    for (long long i = 0; i < 4; i++) {
      long long fx = ex + dx[i], fy = ey + dy[i];
      if (fx < 0 || fx > m || fy < 0 || fy > n) continue;
      cnt += (s[fx][fy] == '.' || (fx == bx && fy == by));
    }
    if (cnt < 2) {
      puts("NO");
      return 0;
    }
  }
  dfs(bx, by);
  puts("NO");
  return ~~(0 - 0);
}
template <typename tn>
inline tn next(void) {
  tn k;
  cin >> k;
  return k;
}
template <typename tn>
inline ostream& operator<<(ostream& os, const vector<tn>& v) {
  for (unsigned i = 0; i < v.size(); i++) os << v[i] << ' ';
  return os;
}
