#include <bits/stdc++.h>
using namespace std;
int n;
pair<long long int, long long int> a[200007];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  std::cin >> n;
  for (int i = 0; i < n; i++) {
    std::cin >> a[i].second >> a[i].first;
  }
  sort(a, a + n);
  for (int i = 0; i < n; i++) {
    long long int tmp;
    tmp = a[i].first;
    a[i].first = a[i].second;
    a[i].second = tmp;
  }
  long long int v[3];
  v[0] = v[1] = -1;
  for (int i = 0; i < n; i++) {
    sort(v, v + 2);
    if (a[i].first > v[1])
      v[1] = a[i].second;
    else if (a[i].first > v[0])
      v[0] = a[i].second;
    else
      return 0 * printf("NO\n");
  }
  printf("YES\n");
}
