#include <bits/stdc++.h>
using namespace std;
const long long M = 1e6 + 7, mod = 1e9 + 7;
map<long long, long long> mp;
long long a[M];
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  {
    long long n;
    cin >> n;
    vector<pair<long long, long long>> v;
    set<long long> s;
    for (long long i = 0; i < n; i++) {
      long long x, y;
      cin >> x >> y;
      s.insert(x);
      s.insert(y);
      s.insert(x + 1);
      s.insert(y + 1);
      v.push_back({x, y});
    }
    long long cnt = 0;
    for (auto u : s) mp[u] = ++cnt;
    for (auto u : v) {
      a[mp[u.first]]++;
      a[mp[u.second] + 1]--;
    }
    for (long long i = 1; i < M; i++) a[i] += a[i - 1];
    for (long long i = 1; i < M; i++) {
      if (a[i] > 2) return cout << "NO", 0;
    }
    cout << "YES"
         << "\n";
  }
  return 0;
}
