#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  vector<int> a(2 * n + 1);
  set<int> s;
  vector<pair<int, int> > interval(n + 1);
  for (int i = 1; i <= n; i++) {
    int l, r;
    cin >> l >> r;
    interval[i] = {l, r};
    a[l] = i;
    a[r] = -i;
  }
  vector<vector<int> > adj(n + 1);
  int cnt = 0;
  for (int i = 1; i <= 2 * n; i++) {
    if (a[i] > 0) {
      int index = a[i];
      int last = interval[index].second;
      for (auto it : s) {
        if (it < last) {
          adj[index].push_back(-a[it]);
          adj[-a[it]].push_back(index);
          cnt++;
          if (cnt > n - 1) {
            cout << "NO\n";
            return 0;
          }
        } else
          break;
      }
      s.insert(last);
    } else {
      s.erase(i);
    }
  }
  if (cnt != n - 1) {
    cout << "NO\n";
    return 0;
  }
  queue<int> q;
  q.push(1);
  vector<int> visited(n + 1);
  while (!q.empty()) {
    int u = q.front();
    q.pop();
    visited[u] = 1;
    for (auto it : adj[u]) {
      if (!visited[it]) {
        visited[it] = 1;
        q.push(it);
      }
    }
  }
  for (int i = 1; i <= n; i++) {
    if (!visited[i]) {
      cout << "NO\n";
      return 0;
    }
  }
  cout << "YES\n";
  return 0;
}
