#include <bits/stdc++.h>
using namespace std;
const int N = 5e5 + 87;
int n, l[N], r[N], a[N], e;
vector<int> g[N];
bool vis[N];
void dfs(int u) {
  if (vis[u]) return;
  vis[u] = 1;
  for (int v : g[u]) dfs(v);
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  for (int i = 0; i < n; ++i) cin >> l[i] >> r[i];
  iota(a, a + n, 0);
  sort(a, a + n, [&](int i, int j) { return l[i] < l[j]; });
  map<int, int> mp;
  for (int i = 0; i < n; ++i) {
    for (auto it = mp.upper_bound(l[a[i]]);
         e < n && it != end(mp) && it->first < r[a[i]]; ++it, ++e) {
      g[a[i]].push_back(it->second);
      g[it->second].push_back(a[i]);
    }
    mp[r[a[i]]] = a[i];
  }
  if (e != n - 1) {
    cout << "NO\n";
    return 0;
  }
  dfs(0);
  cout << (accumulate(vis, vis + n, 0) == n ? "YES\n" : "NO\n");
}
