#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
const long long N = 3e5 + 5;
const long long INF = 1e14;
long long a[N], b[N], idx[N];
bool cmpr(long long i, long long j) {
  if (a[i] == a[j]) return b[i] < b[j];
  return (a[i] < a[j]);
}
int main() {
  ios::sync_with_stdio(false);
  long long n;
  cin >> n;
  for (long long i = 0; i < n; i++) {
    cin >> a[i] >> b[i];
    idx[i] = i;
  }
  sort(idx, idx + n, cmpr);
  long long c = -1, d = -1;
  for (long long i = 0; i < n; i++) {
    long long j = idx[i];
    if (c < a[j])
      c = b[j];
    else if (d < a[j])
      d = b[j];
    else {
      cout << "NO\n";
      return 0;
    }
  }
  cout << "YES\n";
  return 0;
}
