#include <bits/stdc++.h>
using namespace std;
struct Point {
  int x, y;
  Point() {}
  Point(int x, int y) : x(x), y(y) {}
};
const int N = 1e5 + 10;
bool cmpX(const Point &a, const Point &b) {
  if (a.x != b.x) return a.x < b.x;
  return a.y < b.y;
}
int n, l[N], r[N];
int main() {
  scanf("%d", &n);
  vector<Point> v(n);
  for (int i = 0; i < n; ++i) {
    scanf("%d%d", &v[i].x, &v[i].y);
  }
  sort(v.begin(), v.end(), cmpX);
  multiset<int> st;
  int l = 0;
  for (int r = 0; r < n; ++r) {
    while (l < r && *st.begin() < v[r].x) {
      st.erase(st.begin());
      ++l;
    }
    st.insert(v[r].y);
    if (st.size() > 2) return 0 * puts("NO");
  }
  puts("YES");
  return 0;
}
