#include <bits/stdc++.h>
using namespace std;
using llint = long long;
int n, tv[2];
pair<int, int> show[200000];
int main() {
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> show[i].first >> show[i].second;
  }
  sort(show, show + n);
  for (int i = 0; i < n; ++i) {
    bool ok = 0;
    for (int j = 0; j < 2; ++j) {
      if (tv[j] <= show[i].first) {
        tv[j] = show[i].second + 1;
        ok = 1;
        break;
      }
    }
    if (!ok) {
      cout << "NO";
      return 0;
    }
  }
  cout << "YES";
}
