#include <bits/stdc++.h>
using namespace std;
vector<string> grid;
int r1, c1, r2, c2;
int offset[2][4] = {{1, -1, 0, 0}, {0, 0, 1, -1}};
bool isValid(int r, int c) {
  return (r > 0 && r < grid.size() && c > 0 && c < grid[1].size());
}
bool findPath(int r, int c, bool firstMove = true) {
  if (!isValid(r, c)) return false;
  if (grid[r][c] == 'X' && !firstMove)
    return (r == r2 && c == c2);
  else
    grid[r][c] = 'X';
  for (int i = 0; i < 4; ++i)
    if (findPath(r + offset[0][i], c + offset[1][i], false)) return true;
  return false;
}
int main() {
  ios_base::sync_with_stdio(false);
  int n, m;
  cin >> n >> m;
  grid.resize(n + 1);
  for (int i = 1; i <= n; ++i) {
    string row;
    cin >> row;
    grid[i] = string(" " + row);
  }
  cin >> r1 >> c1 >> r2 >> c2;
  findPath(r1, c1) ? puts("YES") : puts("NO");
  return 0;
}
