#include <bits/stdc++.h>
using namespace std;
pair<int, int> shows[200005];
int main() {
  ::ios::sync_with_stdio(false);
  int n;
  int time = 1000000;
  int time1 = 1000000;
  int use = 0;
  int use2 = 0;
  cin >> n;
  int l, r;
  for (int i = 0; i < n; ++i) {
    cin >> shows[i].first >> shows[i].second;
  }
  sort(shows, shows + n);
  for (int i = 0; i < n; ++i) {
    if (shows[i].first > time && time != shows[i].first) {
      time = shows[i].second;
      continue;
    } else if (shows[i].first > time1 && time1 != shows[i].first) {
      time1 = shows[i].second;
      continue;
    }
    if (use == 0) {
      time = shows[i].second;
      use = 1;
      continue;
    } else if (use2 == 0) {
      time1 = shows[i].second;
      use2 = 1;
      continue;
    }
    cout << "NO";
    return 0;
  }
  cout << "YES";
  return 0;
}
