#include <bits/stdc++.h>
using namespace std;
long long int bg = pow(10, 10) + 7;
vector<vector<long long int> > vec(500004);
long long int vis[500004];
void dfs(long long int i) {
  vis[i] = 1;
  long long int j;
  for (j = 0; j < vec[i].size(); j++)
    if (vis[vec[i][j]] == 0) dfs(vec[i][j]);
}
int main() {
  long long int top;
  top = 1;
  while (top--) {
    long long int n, j, i;
    cin >> n;
    vector<pair<long long int, long long int> > hel;
    for (i = 0; i < n; i++) {
      long long int a, b;
      cin >> a >> b;
      hel.push_back(make_pair(a, b));
    }
    sort(hel.begin(), hel.end());
    long long int tot = 0;
    map<long long int, long long int> map1;
    for (i = 0; i < n; i++) {
      map<long long int, long long int>::iterator a = map1.lower_bound(
                                                      hel[i].first),
                                                  b = map1.upper_bound(
                                                      hel[i].second),
                                                  c;
      for (c = a; c != b; c++) {
        tot++;
        vec[i].push_back(c->second);
        vec[c->second].push_back(i);
        if (tot == n) {
          cout << "NO" << '\n';
          return 0;
        }
      }
      map1.insert(make_pair(hel[i].second, i));
    }
    dfs(0);
    for (i = 0; i < n; i++) {
      if (vis[i] == 0) {
        cout << "NO" << '\n';
        return 0;
      }
    }
    cout << "YES";
  }
  return 0;
}
