#include <bits/stdc++.h>   using namespace std;   void mohammed() {     ios::sync_with_stdio(0);     ios_base::sync_with_stdio(0);     cin.tie(0), cout.tie(0);   }   int main() {     mohammed();     int n, x, y;     cin >> n;     map<int, int> mp;     map<int, int>::iterator it;     for (int i = 0; i < n; i++) {       cin >> x >> y;       mp[x]++;       mp[y + 1]--;     }     x = 0;     for (it = mp.begin(); it != mp.end(); it++) {       it->second += x;       if (it->second > 2) {         cout <<  NO ;         return 0;       }       x = it->second;     }     cout <<  YES ;     return 0;   }   