#include <bits/stdc++.h>
using namespace std;
const long double E = 2.71828182845904523536;
const long double pi = acos(-1);
const double eps = 1e-9;
const long long mod = 1e9 + 7;
const long long inf = 1LL << 30;
const int N = 200100;
pair<int, int> a[N];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d%d", &a[i].first, &a[i].second);
  sort(a, a + n);
  int _1 = -1, _2 = -1;
  for (int i = 0; i < n; i++) {
    int x = a[i].first, y = a[i].second;
    if (x > _1)
      _1 = y;
    else if (x > _2)
      _2 = y;
    else {
      printf("NO");
      return 0;
    }
  }
  printf("YES");
  return 0;
}
