#include <bits/stdc++.h>
using namespace std;
class comp {
 public:
  bool operator()(const pair<int, int> a, const pair<int, int> b) {
    if (a.first < b.first) return 0;
    if (a.first == b.first && a.second > b.second) return 0;
    return 1;
  }
};
priority_queue<pair<int, int>, vector<pair<int, int>>, comp> Q;
int main() {
  int n, i, a, b, r1 = -1, r2 = -1;
  pair<int, int> x;
  scanf("%d", &n);
  for (i = 1; i <= n; i++) {
    scanf("%d%d", &a, &b);
    Q.push(make_pair(a, b));
  }
  for (i = 1; i <= n; i++) {
    x = Q.top();
    Q.pop();
    if (r1 < x.first) {
      r1 = x.second;
    } else if (r2 < x.first) {
      r2 = x.second;
    } else {
      printf("NO\n");
      return 0;
    }
  }
  printf("YES\n");
  return 0;
}
