#include <bits/stdc++.h>
using namespace std;
vector<int> dy = {1, 0, -1, 0};
vector<int> dx = {0, 1, 0, -1};
int main(){
  int H, W;
  cin >> H >> W;
  int A, Si, Sj;
  cin >> A >> Si >> Sj;
  int B, Gi, Gj;
  cin >> B >> Gi >> Gj;
  vector<string> M(H);
  for (int i = 0; i < H; i++){
    cin >> M[i];
  }
  vector<vector<vector<bool>>> used(H, vector<vector<bool>>(W, vector<bool>(1200, false)));
  used[Si][Sj][A] = true;
  queue<tuple<int, int, int>> Q;
  Q.push(make_tuple(Si, Sj, A));
  while (!Q.empty()){
    int y = get<0>(Q.front());
    int x = get<1>(Q.front());
    int s = get<2>(Q.front());
    Q.pop();
    for (int i = 0; i < 4; i++){
      int y2 = y + dy[i];
      int x2 = x + dx[i];
      if (0 <= y2 && y2 < H && 0 <= x2 && x2 < W){
        int s2 = s;
        if (M[y2][x2] == '*'){
          s2++;
        } else {
          s2--;
        }
        if (1 <= s2 && s2 < 1200){
          if (!used[y2][x2][s2]){
            used[y2][x2][s2] = true;
            Q.push(make_tuple(y2, x2, s2));
          }
        }
      }
    }
  }
  if (used[Gi][Gj][B]){
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}