#include <bits/stdc++.h>
using namespace std;
const int Size = 1024;
const int mod2 = 998244353;
const int mod = 10007;
const int INF = 0x3f3f3f3f;
const int maxn = 2e6 + 15;
const int base = 307;
struct node {
  int l, r, pos;
} a[maxn];
bool cmp(node a, node b) { return a.l < b.l; }
map<int, int> mp;
int head[maxn];
int nxt[maxn];
int v[maxn];
int tot = 0;
int vis[maxn];
int now;
void add(int x, int y) {
  v[++tot] = y;
  nxt[tot] = head[x];
  head[x] = tot;
}
int f;
void dfs(int pre, int x) {
  vis[x] = 1;
  if (f == 1) return;
  for (int i = head[x]; i; i = nxt[i]) {
    int y = v[i];
    if (y == pre) continue;
    if (vis[y]) {
      f = 1;
      break;
    }
    dfs(x, y);
  }
}
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; n >= i; i++) {
    scanf("%d%d", &a[i].l, &a[i].r);
    a[i].pos = i;
  }
  sort(a + 1, a + n + 1, cmp);
  for (int i = 1; n >= i; i++) {
    auto pos = mp.lower_bound(a[i].l);
    for (auto j = pos; j != mp.end() && j->first < a[i].r; j++) {
      add(a[i].pos, j->second);
      add(j->second, a[i].pos);
      if (tot > 2 * (n - 1)) {
        printf("NO\n");
        return 0;
      }
    }
    mp[a[i].r] = a[i].pos;
  }
  for (int i = 1; n >= i; i++) {
    if (!vis[i]) {
      if (now == 1) {
        printf("NO\n");
        return 0;
      }
      dfs(0, i);
      if (f == 1) {
        printf("NO\n");
        return 0;
      }
      now++;
    }
  }
  printf("YES\n");
  return 0;
}
