#include <bits/stdc++.h>
using namespace std;
long long mn = INT_MAX;
bool myfnc(const pair<long long, long long>& a,
           const pair<long long, long long>& b) {
  if (a.first != b.first)
    return a.first < b.first;
  else
    return a.second < b.second;
}
template <typename K, typename V>
void print_map(std::map<K, V> const& m) {
  for (auto const& pair : m) {
    std::cout << pair.first << ":" << pair.second << "\n";
  }
}
void solve() {
  int n;
  cin >> n;
  vector<pair<long long, long long> > d(n);
  for (int i = 0; i < n; i++) cin >> d[i].first >> d[i].second;
  sort(d.begin(), d.end(), myfnc);
  int key = d[0].second;
  int cnt = 0;
  if (n <= 2) {
    cout << "YES"
         << "\n";
    return;
  }
  vector<pair<long long, long long> > d1;
  for (int i = 1; i < n; i++) {
    if (d[i].first <= key) {
      d1.push_back({d[i].first, d[i].second});
    } else {
      cnt = 0;
      key = d[i].second;
    }
  }
  if (d1.size() <= 1) {
    cout << "YES";
    return;
  }
  key = d1[0].second;
  for (int i = 1; i < d1.size(); i++) {
    if (d1[i].first <= key) {
      cout << "NO"
           << "\n";
      return;
    } else {
      key = d1[i].second;
    }
  }
  cout << "YES"
       << "\n";
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
