#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
int n;
pair<int, int> a[N];
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) scanf("%d%d", &a[i].first, &a[i].second);
  sort(a + 1, a + n + 1);
  int s1 = -1, s2 = -1;
  for (int i = 1; i <= n; ++i) {
    if (a[i].first > s1)
      s1 = a[i].second;
    else if (a[i].first > s2)
      s2 = a[i].second;
    else
      return puts("NO"), 0;
  }
  puts("YES");
  return 0;
}
