#include using namespace std; typedef signed long long ll; #undef _P #define _P(...) (void)printf(__VA_ARGS__) #define FOR(x,to) for(x=0;x>N>>M; FOR(i,N) { cin>>L[i]>>R[i]; if(M-1-R[x]L[x]) { L[x]=M-1-L[x]; R[x]=M-1-R[x]; swap(L[x],R[x]); if(left>L[x]) return _P("NO\n"); } if(y==-1 || L[x]