#include <bits/stdc++.h>
using namespace std;
ifstream in("file.in");
ofstream out("file.out");
long long n, t1 = -1, t2 = -1;
pair<long long, long long> a[200005];
int32_t main() {
  ios_base ::sync_with_stdio(0);
  cin >> n;
  for (long long i = 1; i <= n; i++) cin >> a[i].first >> a[i].second;
  sort(a + 1, a + n + 1);
  for (long long i = 1; i <= n; i++) {
    if (a[i].first > t1)
      t1 = a[i].second;
    else if (a[i].first > t2)
      t2 = a[i].second;
    else {
      cout << "NO";
      return 0;
    }
  }
  cout << "YES";
}
