#include <bits/stdc++.h>
using namespace std;
typedef priority_queue<pair<int, int>, vector<pair<int, int>>,
                       greater<pair<int, int>>>
    rpqpi;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  vector<pair<int, int>> a(n);
  for (int i = 0; i < n; ++i) {
    cin >> a[i].first >> a[i].second;
  }
  sort(a.begin(), a.end());
  int le = -1;
  int ri = -1;
  for (int i = 0; i < n; ++i) {
    if (a[i].first > le) {
      le = a[i].second;
    } else {
      if (a[i].first > ri) {
        ri = a[i].second;
      } else {
        cout << "NO\n";
        return 0;
      }
    }
  }
  cout << "YES\n";
  return 0;
}
