#include using namespace std; int n,m; int a[55][55]; int dx[]={0,0,1,-1}; int dy[]={1,-1,0,0}; int sx,sy; int ex,ey; bool vis[55][55]; int main(){ cin>>n>>m; cin>>sx>>sy>>ex>>ey; for(int i=1;i<=n;i++){ for(int j=1;j<=m;j++){ char c; cin>>c; a[i][j]=c-'0'; } } queue > q; q.push({sx,sy}); while(!q.empty()){ int x=q.front().first; int y=q.front().second; if(x==ex && y==ey){ cout<<"YES"<=1 && tx<=n && ty>=1 && ty<=m && !vis[tx][ty]){ if(a[tx][ty]==a[x][y] || abs(a[tx][ty]-a[x][y])==1){ q.push({tx,ty}); vis[tx][ty]=1; } } int tx2=tx+dx[i]; int ty2=ty+dy[i]; if(tx2>=1 && tx2<=n && ty2>=1 && ty2<=m && !vis[tx2][ty2]){ if(a[tx2][ty2]==a[x][y] && a[tx][ty]