#include #include using namespace std; int main() { int n, m; cin >> n >> m; vectorblocks(m+1); for (int i = 0; i < n; i++) { int l, r; cin >> l >> r; blocks[l]++; blocks[r + 1]--; r = m - 1 - r; l = m - 1 - l; blocks[l]++; blocks[r + 1]--; } for (int i = 0; i < m; i++) { if (blocks[i] > 2) { cout << "NO" << endl; return 0; } blocks[i+1] += blocks[i]; } cout << "YES" << endl; return 0; }