#include using namespace std; int main() { cin.tie(0); ios::sync_with_stdio(false); int n, m, l, r; bool f; string ans = "YES"; cin >> n >> m; vector a(m,0); for(int i = 0; i < n; i++) { cin >> l >> r; f = true; for(int j = l; j <= r; j++) { if(a[j]) { f = false; break; } } if (f) { for(int j = l; j <= r; j++) a[j] = 1; } else { l = m - 1 - l; r = m - 1 - r; f = true; for(int j = r; j <= l; j++) { if(a[j]) { f = false; break; } } if (f) { for(int j = r; j <= l; j++) a[j] = 1; } else { ans = "NO"; break; } } } cout << ans << "\n"; return 0; }