#include <bits/stdc++.h>
long long int maxx(long long int a, long long int b) { return a > b ? a : b; }
long long int minn(long long int a, long long int b) { return a > b ? b : a; }
using namespace std;
long long int gcd(long long int a, long long int b) {
  return b == 0 ? a : gcd(b, a % b);
}
long long int lcm(long long int a, long long int b) {
  return (a * b) / gcd(a, b);
}
long long int poww(long long int base, long long int exp) {
  base %= 1000000007;
  long long int result = 1;
  while (exp > 0) {
    if (exp & 1) result = (result * base) % 1000000007;
    base = (base * base) % 1000000007;
    exp >>= 1;
  }
  return result;
}
int main() {
  vector<pair<int, int>> second;
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    int x, y;
    cin >> x >> y;
    second.push_back(make_pair(x, y));
  }
  sort(second.begin(), second.end());
  pair<int, int> tv1, tv2;
  tv1 = make_pair(-1, -1);
  tv2 = tv1;
  for (int i = 0; i < n; i++) {
    if (second[i].first > tv1.second)
      tv1 = second[i];
    else if (second[i].first > tv2.second)
      tv2 = second[i];
    else
      return cout << "NO", 0;
  }
  cout << "YES";
}
