#include <bits/stdc++.h>
using namespace std;
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  std::cerr << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  std::cerr.write(names, comma - names) << " : " << arg1 << " | ";
  __f(comma + 1, args...);
}
const long long hell = round(1e12);
long long dfs(vector<vector<long long>>& v, vector<long long>& vis,
              long long cur) {
  vis[cur] = 1;
  for (auto x : v[cur]) {
    if (vis[x]) continue;
    dfs(v, vis, x);
  }
  return 0;
}
signed solve() {
  long long n;
  cin >> n;
  vector<pair<long long, long long>> v(n + 1);
  for (long long i = 1; i <= n; i++) {
    cin >> v[i].first >> v[i].second;
  }
  vector<vector<long long>> A(n + 1, vector<long long>(0));
  sort(v.begin(), v.end());
  vector<long long> a(2 * n + 1);
  vector<long long> b(2 * n + 1);
  for (long long i = 1; i <= n; i++) {
    a[v[i].first] = i;
    b[v[i].second] = i;
  }
  set<long long> s;
  long long ed = 0;
  for (long long i = 1; i <= 2 * n; i++) {
    if (a[i] != 0)
      s.insert(i);
    else if (b[i] != 0) {
      long long idx = b[i];
      long long lt = v[idx].first;
      auto itr = s.rbegin();
      auto itr1 = s.end();
      itr1--;
      while (itr != s.rend()) {
        long long lt1 = *itr;
        if (lt1 == lt) break;
        ed++;
        long long idx1 = a[lt1];
        A[idx].push_back(idx1);
        A[idx1].push_back(idx);
        itr++;
        itr1--;
      }
      s.erase(itr1);
      if (ed > n - 1) {
        cout << "NO";
        return 0;
      }
    }
  }
  if (ed != n - 1) {
    cout << "NO" << endl;
    return 0;
  } else {
    vector<long long> vis(n + 1);
    dfs(A, vis, 1ll);
    for (long long i = 1; i <= n; i++) {
      if (vis[i] == 0) {
        cout << "NO";
        return 0;
      }
    }
    cout << "YES";
  }
  return 0;
}
signed main() {
  long long t = 1;
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  while (t--) {
    solve();
  }
  return 0;
}
