#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n;
  cin >> n;
  if (n <= 2) {
    cout << "YES" << '\n';
    return;
  }
  vector<pair<int, int>> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i].first >> a[i].second;
  }
  sort((a).begin(), (a).end());
  vector<int> tv(2, -1);
  tv[0] = 0;
  tv[1] = 1;
  for (int i = 2; i < n; i++) {
    if (a[i].first > a[tv[0]].second) {
      tv[0] = -1;
    }
    if (a[i].first > a[tv[1]].second) {
      tv[1] = -1;
    }
    if (tv[0] == -1) {
      tv[0] = i;
    } else if (tv[1] == -1) {
      tv[1] = i;
    } else {
      cout << "NO" << '\n';
      return;
    }
  }
  cout << "YES" << '\n';
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  solve();
  return 0;
}
