#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long N;
  cin >> N;
  pair<long long, long long> p[N];
  for (long long i = 0; i < N; i++) cin >> p[i].first >> p[i].second;
  sort(p, p + N);
  pair<long long, long long> one = {0, 0}, two = {0, 0};
  for (int i = 0; i < N; i++) {
    if (one.second < p[i].first) one = {0, 0};
    if (two.second < p[i].first) two = {0, 0};
    if (one.second == 0) {
      one = p[i];
      continue;
    } else if (two.second == 0)
      two = p[i];
    else {
      cout << "NO\n";
      return;
    }
  }
  cout << "YES\n";
}
int main() { solve(); }
