#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<pair<int, int> > vec;
  int l, r;
  for (int i = 0; i < n; i++) {
    cin >> l >> r;
    vec.push_back(make_pair(l, r));
  }
  if (n <= 2) {
    cout << "YES" << endl;
    return 0;
  }
  sort(vec.begin(), vec.end());
  int tv1, tv2;
  tv1 = vec[0].second;
  tv2 = vec[1].second;
  for (int i = 2; i < n; i++) {
    if (vec[i].first <= tv1 && vec[i].first <= tv2) {
      cout << "NO" << endl;
      return 0;
    } else if (vec[i].first > tv1) {
      tv1 = vec[i].second;
    } else if (vec[i].first > tv2) {
      tv2 = vec[i].second;
    }
  }
  cout << "YES" << endl;
  return 0;
}
