#include #include #include #include #include #include #include #include #include #include using namespace std; int main(){ int h, w; cin >> h >> w; vector< vector > mp(h, vector(w) ); vector< vector > f(h, vector(w, false) ); vector s(2); vector g(2); cin >> s[0] >> s[1] >> g[0] >> g[1]; for(int i=0; i> tmp; for(int j=0; j > q; q.push(make_pair(s[0], s[1])); f[s[0]][s[1]] = true; while(true){ if( q.empty() ) break; int x = q.front().first; int y = q.front().second; // cout << x << " " << y << endl; if( x == g[0] && y == g[1] ){ cout << "YES" << endl; return 0; } q.pop(); for(int i=0; i<4; i++){ int tx = x + dx[i]; int ty = y + dy[i]; if( tx < 0 || tx >= h || ty < 0 || ty >= w ) continue; if( f[tx][ty] ) continue; if( mp[tx][ty] == mp[x][y]+1 || mp[tx][ty] == mp[x][y] || mp[tx][ty] == mp[x][y]-1 ){ q.push(make_pair(tx, ty)); f[tx][ty] = true; } } for(int i=0; i<4; i++){ int tx = x + dx[i] + dx[i]; int ty = y + dy[i] + dy[i]; if( tx < 0 || tx >= h || ty < 0 || ty >= w ) continue; if( f[tx][ty] ) continue; if( mp[tx][ty] == mp[x][y] ){ q.push(make_pair(tx, ty)); f[tx][ty] = true; } } } cout << "NO" << endl; return 0; }