#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
vector<int> unions;
void init(int n) { unions.assign(n, -1); }
int findSet(int n) {
  if (unions[n] < 0) return n;
  return unions[n] = findSet(unions[n]);
}
void linkSets(int a, int b) {
  if (unions[a] > unions[b])
    unions[a] = b;
  else if (unions[b] > unions[a])
    unions[b] = a;
  else {
    unions[a] = b;
    unions[b]--;
  }
}
void unionSets(int a, int b) {
  if (findSet(a) != findSet(b)) linkSets(findSet(a), findSet(b));
}
struct event {
  ll pos, type, id;
  bool operator<(const event& o) const {
    if (pos != o.pos) return pos < o.pos;
    return type < o.type;
  }
};
void die() {
  cout << "NO" << endl;
  exit(0);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  ll n;
  cin >> n;
  vector<event> events;
  for (ll i = 0; i < n; i++) {
    ll l, r;
    cin >> l >> r;
    r++;
    events.push_back({l, 1, i});
    events.push_back({r, -1, i});
  }
  sort(begin(events), end(events));
  init(n);
  ll edges = 0;
  map<ll, ll, greater<ll>> s;
  ll next = 0;
  for (auto e : events) {
    if (e.type > 0) {
      s[next] = e.id;
      next++;
    } else {
      auto it = s.begin();
      for (; it->second != e.id; it++) {
        if (findSet(e.id) == findSet(it->second)) die();
        edges++;
        unionSets(e.id, it->second);
      }
      s.erase(it);
    }
  }
  if (edges + 1 != n) die();
  cout << "YES" << endl;
}
