#include <bits/stdc++.h>
using namespace std;
int i2, j2;
int n, m;
char arr[501][501];
bool check(int i, int j) {
  if ((i > 0 && i <= n && j <= m && j > 0 && arr[i][j] == '.') ||
      (i == i2 && j == j2))
    return true;
  return false;
}
void dfs(int i, int j, bool x) {
  if (arr[i][j] == '.' || (j == j2 & i == i2 & x))
    arr[i][j] = 'X';
  else
    arr[i][j] = 'B';
  x = false;
  if (check(i + 1, j)) dfs(i + 1, j, x);
  if (check(i - 1, j)) dfs(i - 1, j, x);
  if (check(i, j + 1)) dfs(i, j + 1, x);
  if (check(i, j - 1)) dfs(i, j - 1, x);
}
int main() {
  cin >> n >> m;
  for (int i = 1; i < n + 1; i++)
    for (int j = 1; j < m + 1; j++) cin >> arr[i][j];
  int i1, j1;
  cin >> i1 >> j1 >> i2 >> j2;
  dfs(i1, j1, true);
  if (arr[i2][j2] == 'B')
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
  return 0;
}
