#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  pair<int, int> in[2 * n];
  for (int i = 0; i < 2 * n; i++) {
    cin >> in[i].first;
    if (!(i % 2))
      in[i].second = 0;
    else
      in[i].second = 1;
  }
  sort(in, in + 2 * n);
  int c = 0, ans = INT_MIN;
  for (int i = 0; i < 2 * n; i++) {
    if (in[i].second == 0)
      c++;
    else
      c--;
    ans = max(ans, c);
  }
  if (ans > 2)
    cout << "NO\n";
  else
    cout << "YES\n";
}
