#include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef bitset<2550> bits; int main(){ int h,w; cin >> h >> w; vector a(2),r(2),c(2); for(int i=0; i<2; i++) cin >> a[i] >> r[i] >> c[i]; vector m(h); for(int i=0; i> m[i]; bits inc,dec; bits mask; for(int i=0; i s(1300); s[a[0]].set( (w+1)*r[0] + c[0] ); for(int i=0; i<1600; i++){ //for(int k=max(a[0]-i, 0); k>1) | (s[k]<<(w+1)) | (s[k]>>(w+1)) & mask; if(k+1<1300){ s[k+1] |= tmp & inc; } if(k-1>=0){ s[k-1] |= tmp & dec; } } if(s[a[1]][(w+1)*r[1] + c[1]]){ cout << "Yes" << endl; return 0; } } if(s[a[1]][(w+1)*r[1] + c[1]]){ cout << "Yes" << endl; }else{ cout << "No" << endl; } return 0; }