#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
struct ttt {
  int l, r;
};
ttt qq[205000];
int cmp1(ttt x, ttt y) {
  if (x.l != y.l)
    return x.l < y.l;
  else
    return x.r < y.r;
}
int main() {
  int i, j, k, f1, f2, f3, f4, t1, t2, t3, t4, n, m;
  int T;
  scanf("%d", &n);
  for (i = 1; i <= n; i++) scanf("%d %d", &qq[i].l, &qq[i].r);
  t1 = 0;
  sort(qq + 1, qq + 1 + n, cmp1);
  multiset<int> q1;
  for (i = 1; i <= n; i++) {
    if (q1.size() == 0 || q1.size() == 1) {
      q1.insert(qq[i].r);
    } else {
      t2 = *q1.begin();
      if (t2 < qq[i].l) {
        q1.erase(q1.begin());
        q1.insert(qq[i].r);
      } else {
        t1 = 1;
      }
    }
  }
  if (t1)
    cout << "NO" << endl;
  else
    cout << "YES" << endl;
  return 0;
}
