#include <bits/stdc++.h>
using namespace std;
vector<bool> used;
vector<vector<int>> m;
bool ans = false;
int n, h = 0;
vector<vector<int>> a;
set<vector<int>> d;
void dfs(int v) {
  ++h;
  used[v] = true;
  for (auto u : a[v]) {
    if (not used[u]) {
      dfs(u);
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  cin >> n;
  a.resize(n);
  int k = 0;
  for (int i = 0; i < n; ++i) {
    int l, r;
    cin >> l >> r;
    m.push_back({l, r});
  }
  sort(m.begin(), m.end());
  for (int i = 0; i < n; ++i) {
    int l = m[i][0], r = m[i][1];
    auto it = d.upper_bound({l, 1000000007});
    while (it != d.end() && (*it)[0] < r) {
      a[i].push_back((*it)[1]);
      a[(*it)[1]].push_back(i);
      ++k;
      ++it;
    }
    if (k >= n) {
      cout << "NO" << endl;
      exit(0);
    }
    d.insert({r, i});
  }
  used.assign(n, false);
  dfs(0);
  if (ans || h < n) {
    cout << "NO" << endl;
  } else {
    cout << "YES" << endl;
  }
}
