#include <bits/stdc++.h>
#pragma GCC optimize("O2")
using namespace std;
const int MAXN = 1e6 + 10;
const long long MOD = 1e9 + 7;
const long long MOD2 = 998244353;
const long long INF = 8e18;
const int LOG = 22;
long long pw(long long a, long long b, long long mod) {
  return (!b ? 1
             : (b & 1 ? (a * pw(a * a % mod, b / 2, mod)) % mod
                      : pw(a * a % mod, b / 2, mod)));
}
int l[MAXN], r[MAXN], mark[MAXN];
vector<pair<int, int> > nodes;
set<pair<int, int> > stl, str;
vector<int> G[MAXN];
void DFS(int V) {
  mark[V] = 1;
  for (auto u : G[V]) {
    if (mark[u]) continue;
    DFS(u);
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  int n, cnt = 0;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> l[i] >> r[i];
    stl.insert(make_pair(l[i], i));
    str.insert(make_pair(r[i], i));
    nodes.push_back(make_pair(r[i] - l[i], i));
  }
  sort((nodes).begin(), (nodes).end());
  for (auto x : nodes) {
    int i = x.second;
    auto it = stl.upper_bound(make_pair(l[i], i));
    while (it != stl.end() && cnt <= n && l[it->second] < r[i]) {
      cnt++;
      G[i].push_back(it->second);
      G[it->second].push_back(i);
      it++;
    }
    it = str.upper_bound(make_pair(l[i], i));
    while (it != str.end() && cnt <= n && r[it->second] < r[i]) {
      cnt++;
      G[i].push_back(it->second);
      G[it->second].push_back(i);
      it++;
    }
    stl.erase(make_pair(l[i], i));
    str.erase(make_pair(r[i], i));
  }
  if (cnt >= n) {
    return cout << "NO", 0;
  }
  cnt = 0;
  for (int i = 1; i <= n; i++) {
    if (!mark[i]) {
      DFS(i);
      cnt++;
    }
  }
  if (cnt != 1) {
    return cout << "NO", 0;
  }
  cout << "YES";
  return 0;
}
