#include <bits/stdc++.h>
using namespace std;
struct segment {
  int l, r;
  bool operator<(const segment &s) const { return l < s.l; }
};
int main(void) {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int n;
  cin >> n;
  vector<segment> seg(n);
  for (int i = 0; i < n; i++) {
    cin >> seg[i].l >> seg[i].r;
  }
  sort(seg.begin(), seg.end());
  vector<int> pos(2 * n + 1);
  for (int i = 0; i < n; i++) {
    pos[seg[i].r] = i;
  }
  set<int> r_pos;
  vector<vector<int>> graph(n);
  int cnt = 0;
  auto add_edge = [&](int &a, int &b) {
    graph[a].emplace_back(b);
    graph[b].emplace_back(a);
    cnt++;
  };
  for (int i = 0; i < n; i++) {
    auto up = r_pos.lower_bound(seg[i].l), right = r_pos.lower_bound(seg[i].r);
    for (auto it = r_pos.begin(); it != up; r_pos.erase(it++))
      ;
    for (auto it = r_pos.begin(); it != right && cnt < n;
         add_edge(i, pos[*it]), it++)
      ;
    r_pos.emplace(seg[i].r);
  }
  if (cnt == n - 1) {
    queue<int> q;
    vector<bool> vis(n);
    q.emplace(0);
    int tot = 0;
    while (!q.empty()) {
      int t = q.front();
      q.pop();
      if (vis[t]) {
        continue;
      }
      vis[t] = true;
      tot++;
      for (auto v : graph[t]) {
        q.emplace(v);
      }
    }
    if (tot == n) {
      cout << "YES" << endl;
      return 0;
    }
  }
  cout << "NO" << endl;
  return 0;
}
