#include <bits/stdc++.h>
using namespace std;
struct tim {
  int begin, end;
} t[200005];
int cmp(tim a, tim b) {
  if (a.begin != b.begin) return a.begin < b.begin;
  return a.end < b.end;
}
int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> t[i].begin >> t[i].end;
  sort(t + 1, t + n + 1, cmp);
  t[0].end = -1;
  int p[3] = {0};
  int i;
  for (i = 1; i <= n; i++) {
    if (t[p[1]].end < t[i].begin) {
      p[1] = i;
      continue;
    }
    if (t[p[2]].end < t[i].begin) {
      p[2] = i;
      continue;
    }
    break;
  }
  if (i > n)
    cout << "YES";
  else
    cout << "NO";
}
