#include <bits/stdc++.h>
using namespace std;
long long G(long long a, long long b) {
  if (b == 0) return a;
  return G(b, a % b);
}
char ch[555][555];
bool mark[555 * 555];
vector<long long> adj[555 * 555];
void dfs(long long r) {
  mark[r] = 1;
  for (int i = 0; i < adj[r].size(); i++) {
    long long tmp = adj[r][i];
    if (!mark[tmp]) dfs(tmp);
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  long long n, m, a, b, c, d, e = 0;
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      cin >> ch[i][j];
      if (ch[i][j] == '.') {
        if (i && ch[i - 1][j] == '.') {
          adj[i * m + j].push_back(i * m + j - m);
          adj[i * m + j - m].push_back(i * m + j);
        }
        if (j && ch[i][j - 1] == '.') {
          adj[i * m + j].push_back(i * m + j - 1);
          adj[i * m + j - 1].push_back(i * m + j);
        }
      }
    }
  }
  cin >> a >> b >> c >> d;
  a--, b--, c--, d--;
  if (a && ch[a - 1][b] == '.') {
    adj[a * m + b].push_back(a * m + b - m);
    adj[a * m + b - m].push_back(a * m + b);
  }
  if (a < n - 1 && ch[a + 1][b] == '.') {
    adj[a * m + b].push_back(a * m + b + m);
    adj[a * m + b + m].push_back(a * m + b);
  }
  if (b && ch[a][b - 1] == '.') {
    adj[a * m + b].push_back(a * m + b - 1);
    adj[a * m + b - 1].push_back(a * m + b);
  }
  if (b < m - 1 && ch[a][b + 1] == '.') {
    adj[a * m + b].push_back(a * m + b + 1);
    adj[a * m + b + 1].push_back(a * m + b);
  }
  if (c && ch[c - 1][d] == '.') {
    adj[c * m + d].push_back(c * m + d - m);
    adj[c * m + d - m].push_back(c * m + d);
  }
  if (c < n - 1 && ch[c + 1][d] == '.') {
    adj[c * m + d].push_back(c * m + d + m);
    adj[c * m + d + m].push_back(c * m + d);
  }
  if (d && ch[c][d - 1] == '.') {
    adj[c * m + d].push_back(c * m + d - 1);
    adj[c * m + d - 1].push_back(c * m + d);
  }
  if (d < m - 1 && ch[c][d + 1] == '.') {
    adj[c * m + d].push_back(c * m + d + 1);
    adj[c * m + d + 1].push_back(c * m + d);
  }
  if ((abs(a - c) + abs(b - d)) == 1) {
    adj[a * m + b].push_back(c * m + d);
    adj[c * m + d].push_back(a * m + b);
    e++;
  }
  dfs(a * m + b);
  if (c && ch[c - 1][d] == '.') e++;
  if (c < n - 1 && ch[c + 1][d] == '.') e++;
  if (d && ch[c][d - 1] == '.') e++;
  if (d < m - 1 && ch[c][d + 1] == '.') e++;
  if (!mark[c * m + d] || e == 0)
    cout << "NO\n";
  else if (ch[c][d] == 'X')
    cout << "YES\n";
  else if (e > 1)
    cout << "YES\n";
  else
    cout << "NO\n";
}
