#include <bits/stdc++.h>
using namespace std;
long long int modexp(long long int a, long long int b) {
  long long int res = 1;
  while (b > 0) {
    if (b & 1) res = (res * a) % 1000000007;
    a = (a * a) % 1000000007;
    b /= 2;
  }
  return res;
}
const long long int N = 200009;
long long int n, i, one_e, two_e;
bool pos = true;
pair<long long int, long long int> v[N];
int main() {
  std::ios::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n;
  for (i = (long long int)0; i < (long long int)n; i++)
    cin >> v[i].first >> v[i].second;
  sort(v, v + n);
  one_e = two_e = -1;
  for (i = 0; i < n and pos; i++) {
    if (v[i].first > one_e) {
      one_e = v[i].second;
    } else {
      if (v[i].first > two_e)
        two_e = v[i].second;
      else
        pos = false;
    }
  }
  cout << (pos ? "YES" : "NO");
  return 0;
}
