#include <bits/stdc++.h>
using namespace std;
int n;
int l[200100], r[200100];
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d%d", &l[i], &r[i]);
  sort(l + 1, l + n + 1);
  sort(r + 1, r + n + 1);
  for (int i = 1; i <= n - 2; i++)
    if (l[i + 2] <= r[i]) {
      puts("NO");
      return 0;
    }
  puts("YES");
  return 0;
}
