#include <bits/stdc++.h>
using namespace std;
const int N = 5e5 + 5;
vector<int> e[N];
int used[N];
void addedge(int u, int v) {
  e[u].push_back(v);
  e[v].push_back(u);
}
void dfs(int cur) {
  if (cur == 0) used[cur] = 1;
  for (int nxt : e[cur]) {
    if (!used[nxt]) {
      used[nxt] = 1;
      dfs(nxt);
    }
  }
}
map<int, int> mp;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  vector<pair<int, int> > segs;
  for (int i = 0; i < n; i++) {
    int l, r;
    cin >> l >> r;
    segs.push_back(make_pair(l, r));
  }
  sort(segs.begin(), segs.end());
  int cnt = 0;
  for (int i = 0; i < n; i++) {
    for (auto it = mp.lower_bound(-segs[i].second); it != mp.end(); it++) {
      int val = -(it->first), idx = it->second;
      if (val < segs[i].first) break;
      cnt++;
      if (cnt == n) {
        cout << "NO\n";
        return 0;
      }
      addedge(idx, i);
    }
    mp[-segs[i].second] = i;
  }
  if (cnt != n - 1) {
    cout << "NO\n";
    return 0;
  }
  dfs(0);
  for (int i = 0; i < n; i++)
    if (!used[i]) {
      cout << "NO\n";
      return 0;
    }
  cout << "YES\n";
  return 0;
}
