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