#include <bits/stdc++.h>
using namespace std;
class UnionFind {
 private:
  int siz;
  vector<int> a;

 public:
  UnionFind(int x) : siz(x), a(x, -1) {}
  int root(int x) { return a[x] < 0 ? x : a[x] = root(a[x]); }
  bool unite(int x, int y) {
    x = root(x);
    y = root(y);
    if (x == y) return false;
    siz--;
    if (a[x] > a[y]) swap(x, y);
    a[x] += a[y];
    a[y] = x;
    return true;
  }
  bool same(int x, int y) { return root(x) == root(y); }
  int size(int x) { return -a[root(x)]; }
  int connected_component() { return siz; }
};
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector<vector<int>> points;
  vector<vector<int>> segs;
  for (int i = 0; i < n; i++) {
    int l, r;
    cin >> l >> r;
    segs.push_back({l, r});
  }
  sort(segs.begin(), segs.end());
  for (int i = 0; i < n; i++) {
    points.push_back({segs[i][0], i, 1});
    points.push_back({segs[i][1], i, 0});
  }
  sort(points.begin(), points.end());
  set<int> st;
  UnionFind uf(n);
  for (const auto& v : points) {
    if (v[2]) {
      st.insert(v[1]);
    } else {
      st.erase(v[1]);
      for (auto it = st.upper_bound(v[1]); it != st.end(); it++) {
        if (!uf.unite(v[1], *it)) {
          cout << "NO\n";
          return 0;
        }
      }
    }
  }
  if (uf.connected_component() != 1) {
    cout << "NO\n";
  } else {
    cout << "YES\n";
  }
  return 0;
}
