#include <bits/stdc++.h>
using namespace std;
vector<pair<int, int> > shows;
int main() {
  int n;
  cin >> n;
  while (n--) {
    int s, f;
    cin >> s >> f;
    shows.push_back(pair<int, int>(s, f));
  }
  int tv1 = -1, tv2 = -1;
  sort(shows.begin(), shows.end());
  for (pair<int, int> show : shows) {
    if (show.first > tv1)
      tv1 = show.second;
    else if (show.first > tv2)
      tv2 = show.second;
    else {
      cout << "NO" << endl;
      return 0;
    }
  }
  cout << "YES" << endl;
}
