#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 2;
std::vector<int> adj[N];
std::vector<int> vis(N, 0);
void dfs(int node) {
  if (vis[node]) return;
  vis[node] = 1;
  for (auto nxt : adj[node]) dfs(nxt);
}
void solve() {
  int n;
  cin >> n;
  if (n == 1) {
    cout << "YES" << endl;
    return;
  }
  vector<pair<int, int> > cn;
  std::vector<int> R(n);
  pair<int, int> points;
  for (int i = 0; i < n; ++i) {
    cin >> points.first >> points.second;
    cn.push_back({points.first, i});
    cn.push_back({points.second, i});
    R[i] = points.second;
  }
  sort(cn.begin(), cn.end());
  set<pair<int, int> > activePnts;
  int edgeCount = 0;
  for (int i = 0; i < (int)cn.size(); ++i) {
    if (edgeCount == n)
      break;
    else if (activePnts.count(cn[i])) {
      activePnts.erase(cn[i]);
    } else {
      int idx = cn[i].second;
      int r = R[idx];
      for (auto cur : activePnts) {
        if (cur.first > r) break;
        edgeCount++;
        adj[cur.second].push_back(idx);
        adj[idx].push_back(cur.second);
        if (edgeCount == n) break;
      }
      activePnts.insert({r, idx});
    }
  }
  dfs(0);
  for (int i = 0; i < n; ++i) {
    if (!vis[i]) {
      cout << "NO" << endl;
      return;
    }
  }
  if (edgeCount == n - 1) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  int T = 1;
  while (T--) {
    solve();
  }
}
