#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
int MOD = 1000000007;
ll INF = 1LL << 62;
ld EPS = 1e-8;
ld PI = acos(-1);
int N;
vector<pair<int, bool>> vals;
map<int, int> endof, idx;
vector<int> adj[500010];
bool reach[500010];
int reached = 0;
void flood(int p) {
  if (reach[p]) return;
  reach[p] = 1;
  reached++;
  for (int i : adj[p]) flood(i);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(10);
  cin >> N;
  for (int i = 0; i < N; i++) {
    int l, r;
    cin >> l >> r;
    endof[l] = r;
    idx[l] = i;
    idx[r] = i;
    vals.push_back({l, true});
    vals.push_back({r, false});
  }
  sort(vals.begin(), vals.end());
  int i = 1;
  set<int> ends;
  ends.insert(endof[vals[0].first]);
  int edges = 0;
  int NEEDED = N + 10;
  while (i < vals.size()) {
    auto t = vals[i];
    if (t.second) {
      auto it = ends.upper_bound(t.first);
      while (edges <= NEEDED && it != ends.end()) {
        int first = *it;
        if (first > endof[t.first]) break;
        adj[idx[t.first]].push_back(idx[first]);
        adj[idx[first]].push_back(idx[t.first]);
        it++;
        edges++;
      }
      ends.insert(endof[t.first]);
    } else {
      ends.erase(t.first);
    }
    i++;
  }
  if (edges >= N)
    cout << "NO\n";
  else {
    flood(0);
    if (reached == N)
      cout << "YES\n";
    else
      cout << "NO\n";
  }
  return 0;
}
