#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<pair<int, int> > v;
  for (int i = 0; i < n; i++) {
    int a, b;
    cin >> a >> b;
    v.push_back({a, b});
  }
  sort(v.begin(), v.end());
  int fi = v[0].second, se = v[1].second;
  for (int i = 2; i < n; i++) {
    if (v[i].first > fi) {
      fi = v[i].second;
    } else if (v[i].first > se) {
      se = v[i].second;
    } else {
      cout << "NO\n";
      return 0;
    }
  }
  cout << "YES\n";
  return 0;
}
