#include using namespace std; typedef pair P; const int di[]={-1, 0,1,0}; const int dj[]={ 0,-1,0,1}; string s[60]; int used[60][60]; int main(){ int h,w; cin >> h >> w; int si,sj,ti,tj; cin >> si >> sj >> ti >> tj; for(int i=0;i> s[i]; } queue > q; --si,--sj,--ti,--tj; q.push(pair (si,sj)); while(q.size()){ int i=q.front().first; int j=q.front().second; q.pop(); if(used[i][j]) continue; used[i][j]=1; for(int v=0;v<4;v++){ int ni=i+di[v], nj=j+dj[v]; if(ni<0 || nj<0 | ni>=h || nj>=w) continue; if(abs(s[i][j]-s[ni][nj]) <= 1){ q.push(pair (ni,nj)); } if(s[i][j]>s[ni][nj]){ ni+=di[v], nj+=dj[v]; if(ni<0 || nj<0 || ni>=h || nj>=w) continue; if(s[i][j]==s[ni][nj]){ q.push(pair (ni,nj)); } } } } if(used[ti][tj]) cout << "YES" << endl; else cout << "NO" << endl; return 0; }