#include <cstdio>
#include <algorithm>
#include <stack>
#include <queue>
#include <deque>
#include <vector>
#include <string>
#include <string.h>
#include <cstdlib>
#include <ctime>
#include <cmath>
#include <map>
#include <set>
#include <iostream>
#include <sstream>
#include <numeric>
#include <cctype>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < n; ++i)
#define rrep(i,n) for(int i = 1; i <= n; ++i)
#define drep(i,n) for(int i = n-1; i >= 0; --i)
#define gep(i,g,j) for(int i = g.head[j]; i != -1; i = g.e[i].next)
#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcount
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define df(x) int x = in()
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
inline int in() { int x; scanf("%d",&x); return x;}
inline void priv(vi a) { rep(i,sz(a)) printf("%d%c",a[i],i==sz(a)-1?'\n':' ');}

const int MX = 55, INF = 1000010000;
const ll LINF = 1000000000000000000ll;
const double eps = 1e-10;
const int di[] = {-1,0,1,0}, dj[] = {0,-1,0,1}; //^<v>

int h, w;
int a, si, sj;
int b, ti, tj;
string t[MX];
int d[MX][MX][2005];
struct dat { int i, j, s;};

int main() {
  scanf("%d%d",&h,&w);
  scanf("%d%d%d",&a,&si,&sj); 
  scanf("%d%d%d",&b,&ti,&tj);
  rep(i,h) cin >> t[i];
  queue<dat> q;
  d[si][sj][a] = 1;
  q.push({si,sj,a});
  while (sz(q)) {
    dat nd = q.front(); q.pop();
    int i = nd.i;
    int j = nd.j;
    int s = nd.s;
    rep(v,4) {
      int ni = i+di[v], nj = j+dj[v];
      if (ni<0||nj<0||ni>=h||nj>=w) continue;
      int ns = s;
      if (t[ni][nj] == '*') ++ns; else --ns;
      if (ns > 2000) continue;
      if (!ns) continue;
      if (d[ni][nj][ns]) continue;
      q.push({ni,nj,ns});
      d[ni][nj][ns] = 1;
    }
  }
  if (d[ti][tj][b]) puts("Yes"); else puts("No");
  return 0;
}