#include <bits/stdc++.h>
using namespace std;
long long mod = 1000000007;
long double EPS = 1e-9;
long long int pow(long long int x, long long int y) {
  long long int res = 1;
  while (y) {
    if (y & 1) res = (res * x) % mod;
    y = y / 2, x = (x * x) % mod;
  }
  return res % mod;
}
int dx[4] = {1, -1, 0, 0};
int dy[4] = {0, 0, 1, -1};
vector<string> g;
vector<vector<bool>> vis;
bool h;
pair<long long int, long long int> target;
int n, m;
bool valid(int x, int y) {
  return x >= 0 && y >= 0 && x < n && y < m && g[x][y] == '.';
}
void dfs(pair<long long int, long long int> nn, bool mark) {
  {};
  if (nn == target) {
    h = 1;
    return;
  }
  vis[nn.first][nn.second] = 1;
  if (mark) g[nn.first][nn.second] = 'X';
  for (int k = 0; k < 4; k++) {
    int x = nn.first + dx[k];
    int y = nn.second + dy[k];
    if (valid(x, y) && !vis[x][y]) {
      dfs(make_pair(x, y), mark);
    }
  }
}
void solve() {
  cin >> n >> m;
  g.resize(n);
  for (long long int i = 0; i < (n); ++i) cin >> g[i];
  pair<long long int, long long int> T, second;
  cin >> second.first >> second.second;
  cin >> T.first >> T.second;
  second.first--;
  second.second--;
  T.second--;
  T.first--;
  if (second == T) {
    int cnt = 0;
    for (int k = 0; k < 4; k++)
      if (valid(T.first + dx[k], T.second + dy[k])) cnt++;
    if (cnt)
      cout << "YES" << '\n';
    else
      cout << "NO" << '\n';
    return;
  }
  if (g[T.first][T.second] == 'X') {
    {};
    h = 0;
    target = T;
    g[T.first][T.second] = '.';
    vis = vector<vector<bool>>(n, vector<bool>(m, 0));
    dfs(second, 0);
    if (h == 1) {
      cout << "YES" << '\n';
      return;
    } else {
      cout << "NO" << '\n';
      return;
    }
  } else {
    g[second.first][second.second] = '.';
    int cnt = 0;
    for (int k = 0; k < 4; k++)
      if (valid(T.first + dx[k], T.second + dy[k])) cnt++;
    if (cnt >= 2) {
      target = second;
      vis = vector<vector<bool>>(n, vector<bool>(m, 0));
      h = 0;
      dfs(T, 0);
      if (h == 1) {
        cout << "Yes" << '\n';
        return;
      }
      cout << "NO" << '\n';
      return;
    } else {
      cout << "NO" << '\n';
      return;
    }
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  int test_Cases = 1;
  while (test_Cases--) {
    solve();
  }
}
