#include <bits/stdc++.h>
using namespace std;
struct tv {
  long long begin;
  long long end;
};
bool cmp(tv a, tv b) { return a.begin < b.begin; }
int main() {
  ios::sync_with_stdio(false);
  vector<tv> t;
  int n;
  cin >> n;
  t.resize(n);
  for (int i = 0; i < n; i++) {
    cin >> t[i].begin >> t[i].end;
  }
  sort(t.begin(), t.end(), cmp);
  int temp1 = 0;
  int temp2 = 0;
  if (t[0].end > t[1].end) {
    temp1 = t[0].end;
    temp2 = t[1].end;
  } else {
    temp1 = t[1].end;
    temp2 = t[0].end;
  }
  for (int i = 2; i < n; i++) {
    if (t[i].begin <= temp2) {
      cout << "NO" << endl;
      return 0;
    } else if (t[i].begin > temp2) {
      if (t[i].end > temp1) {
        temp2 = temp1;
        temp1 = t[i].end;
      } else {
        temp2 = t[i].end;
      }
    }
  }
  cout << "YES" << endl;
  return 0;
}
