#include <bits/stdc++.h>
using namespace std;
template <class T>
bool uin(T &a, T b) {
  return a > b ? (a = b, true) : false;
}
template <class T>
bool uax(T &a, T b) {
  return a < b ? (a = b, true) : false;
}
const long long maxn = 1000001, mod = 1e9 + 7;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  pair<long long, long long> p[n];
  vector<long long> v;
  for (long long i = 0; i < (long long)(n); ++i) {
    cin >> p[i].first >> p[i].second;
    v.push_back(p[i].first);
    v.push_back(p[i].second);
  }
  sort(v.begin(), v.end());
  v.resize(unique(v.begin(), v.end()) - v.begin());
  int hsh[int(2 * 1e6 + 1)];
  memset(hsh, 0, sizeof(hsh));
  for (int i = 0; i < n; i++) {
    int idx1 = lower_bound((v).begin(), (v).end(), p[i].first) - v.begin();
    int idx2 = upper_bound((v).begin(), (v).end(), p[i].second) - v.begin();
    hsh[idx1]++;
    hsh[idx2]--;
  }
  string ans = "YES";
  for (int i = 1; i < 2 * 1e6 + 1; i++) {
    hsh[i] = hsh[i] + hsh[i - 1];
    if (hsh[i] > 2) ans = "NO";
  }
  cout << ans;
  return 0;
}
