char s[199][99];n=1,m;f(p,q,t,T){for(T=4*!s[p+99][q]++;T--;t=n,n=m,m=-t)t=s[p][q],t=t-s[p+n+n][q+m+m]|(t-=s[p+n][q+m])<2?abs(t)<2:2,f(p+n*t,q+m*t);}main(i,a,b,x,y){for(scanf("%*d%*d%d%d%d%d ",&a,&b,&x,&y);gets(s[i++]+1););puts(s[x+99][y]?"YES":"NO");}