#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 1;
struct abc {
  int l, r;
};
abc a[maxn];
bool cmp(abc f1, abc f2) { return f1.l < f2.l; }
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d%d", &a[i].l, &a[i].r);
  }
  sort(a + 1, a + 1 + n, cmp);
  int max1r = a[1].r, max2r = -1;
  for (int i = 2; i <= n; i++) {
    if (max1r < a[i].l)
      max1r = a[i].r;
    else if (max2r < a[i].l)
      max2r = a[i].r;
    else {
      printf("NO\n");
      return 0;
    }
  }
  printf("YES\n");
  return 0;
}
