#include <bits/stdc++.h>
const int N = 5 * 1e5 + 1;
const int M = 1e6 + 1;
const int inf = 1e9;
const int base = 1e9 + 7;
using namespace std;
int n;
pair<int, int> a[N];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i].first >> a[i].second;
  }
  sort(a, a + n);
  int r1 = -1, r2 = -1;
  for (int i = 0; i < n; i++) {
    if (r1 < a[i].first) {
      r1 = a[i].second;
      continue;
    }
    if (r2 < a[i].first) {
      r2 = a[i].second;
      continue;
    }
    cout << "NO";
    return 0;
  }
  cout << "YES";
}
