#include <bits/stdc++.h>
using namespace std;
vector<pair<int, int> > v;
int main() {
  ios::sync_with_stdio(false), cin.tie(0);
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    int a, b;
    cin >> a >> b;
    v.push_back({a, b});
  }
  sort(v.begin(), v.end());
  if (n <= 2) {
    cout << "YES" << '\n';
    return 0;
  }
  int next = 0;
  pair<int, int> f = {0, 0};
  pair<int, int> s = {0, 0};
  while (true) {
    if (f.second < s.second) {
      f = v[next++];
    } else if (f.second > s.second) {
      s = v[next++];
    } else {
      f = v[next++];
      s = v[next++];
    }
    if (next >= n) {
      break;
    }
    if (v[next].first <= f.second && v[next].first <= s.second) {
      cout << "NO" << '\n';
      return 0;
    }
  }
  cout << "YES" << '\n';
}
