#include <bits/stdc++.h>
using namespace std;
long long n, f, s;
bool sec;
vector<pair<long long, long long> > v;
int main() {
  ios::sync_with_stdio(0);
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> f >> s;
    v.push_back(make_pair(f, s));
  }
  sort(v.begin(), v.end());
  long long cur1 = -1, cur2 = -1;
  for (int i = 0; i < n; i++) {
    if (v[i].first > cur1)
      cur1 = v[i].second;
    else if (v[i].first > cur2)
      cur2 = v[i].second;
    else {
      cout << "NO" << endl;
      return 0;
    }
  }
  cout << "YES" << endl;
  return 0;
}
