#include <bits/stdc++.h>
using namespace std;
long long bigmod(long long b, long long p, long long m) {
  if (p == 0) return 1;
  long long my = bigmod(b, p / 2, m);
  my *= my;
  my %= m;
  if (p & 1) my *= b, my %= m;
  return my;
}
int setb(int n, int pos) { return n = n | (1 << pos); }
int resb(int n, int pos) { return n = n & ~(1 << pos); }
bool checkb(int n, int pos) { return (bool)(n & (1 << pos)); }
struct info {
  int x, y, idx;
  info() {}
  info(int _x, int _y, int _idx) {
    x = _x;
    y = _y;
    idx = _idx;
  }
  bool operator<(const info &p) const {
    if (y == p.y)
      return x < p.x;
    else
      return y < p.y;
  }
};
info ara[200005];
bool taken[200005];
int n;
int last[2];
bool fuck() {
  int i;
  last[0] = last[1] = -1;
  for (i = 1; i <= n; i++) {
    if (last[0] > last[1]) swap(last[0], last[1]);
    if (ara[i].x > last[1]) {
      last[1] = ara[i].y;
      continue;
    }
    if (ara[i].x > last[0]) {
      last[0] = ara[i].y;
      continue;
    }
    return 0;
  }
  return 1;
}
int main() {
  int x, y, i;
  scanf("%d", &n);
  for (i = 1; i <= n; i++) {
    scanf("%d %d", &x, &y);
    ara[i] = info(x, y, i);
  }
  sort(ara + 1, ara + n + 1);
  bool f = fuck();
  if (f)
    puts("YES");
  else
    puts("NO");
  return 0;
}
