#include <bits/stdc++.h>
using namespace std;
vector<pair<int, int> > v;
int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    int a, b;
    cin >> a >> b;
    v.push_back(make_pair(a, b));
  }
  sort(v.begin(), v.end());
  int end1 = -1, end2 = -1;
  bool ok = true;
  for (int i = 0; i < v.size(); i++) {
    if (v[i].first > end1)
      end1 = v[i].second;
    else {
      if (v[i].first > end2)
        end2 = v[i].second;
      else {
        ok = false;
        break;
      }
    }
  }
  if (ok)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
}
