#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007LL;
long long n, m;
long long x1, Y1, x2, y2;
long long dx[] = {0, 0, 1, -1};
long long dy[] = {1, -1, 0, 0};
vector<string> g;
bool dfs(long long x, long long y) {
  if (x == x2 && y == y2) {
    if (g[x][y] == 'X') return true;
  }
  if (g[x][y] == 'X') return false;
  bool answer = false;
  g[x][y] = 'X';
  for (int i = 0; i < 4; i++) {
    long long nx = x + dx[i], ny = y + dy[i];
    if (!(nx < 0 || nx >= n || ny < 0 || ny >= m)) answer |= dfs(nx, ny);
    if (answer) break;
  }
  return answer;
}
void solve() {
  cin >> n >> m;
  g = vector<string>(n);
  for (int i = 0; i < n; i++) {
    cin >> g[i];
  }
  cin >> x1 >> Y1 >> x2 >> y2;
  --x1, --x2, --Y1, --y2;
  g[x1][Y1] = '.';
  if (dfs(x1, Y1)) {
    cout << "YES";
  } else {
    cout << "NO";
  }
}
int main(int argc, char const *argv[]) {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int T = 1;
  while (T--) {
    solve();
  }
  return 0;
}
