#include <bits/stdc++.h>
using namespace std;
int n, x, y;
vector<pair<int, int>> p;
int main() {
  ios::sync_with_stdio(false);
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> x >> y;
    p.push_back(make_pair(x, y));
  }
  sort(p.begin(), p.end());
  int one = -1, two = -1;
  for (pair<int, int> s : p) {
    if (one < s.first)
      one = s.second;
    else if (two < s.first)
      two = s.second;
    else {
      cout << "NO";
      return 0;
    }
  }
  cout << "YES";
}
