#include <bits/stdc++.h>
using namespace std;
class abc {
 public:
  long long int l, r, s;
};
bool fun(abc a, abc b) {
  if (a.l != b.l) {
    return a.l < b.l;
  }
  return a.r < b.r;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long int n;
  cin >> n;
  abc arr[n];
  for (long long int i = 0; i < n; i++) {
    cin >> arr[i].l >> arr[i].r;
  }
  vector<long long int> xy1(n, 0), xy2(n, 0);
  for (long long int i = 0; i < n; i++) {
    xy1[i] = arr[i].l;
  }
  for (long long int i = 0; i < n; i++) {
    xy2[i] = arr[i].r;
  }
  sort(xy1.begin(), xy1.end());
  sort(xy2.begin(), xy2.end());
  {
    vector<long long int> vv;
    for (long long int i = 0; i < n; i++) {
      vv.push_back(arr[i].l);
      vv.push_back(arr[i].r);
    }
    sort(vv.begin(), vv.end());
    long long int ans = 0;
    for (long long int i = 0; i < vv.size(); i++) {
      long long int k = vv[i];
      long long int z1 = upper_bound(xy1.begin(), xy1.end(), k) - xy1.begin();
      long long int z2 = lower_bound(xy2.begin(), xy2.end(), k) - xy2.begin();
      z1 = n - z1;
      ans = max(ans, n - z1 - z2);
    }
    if (ans >= 3) {
      cout << "NO\n";
    } else {
      cout << "YES\n";
    }
  }
}
