#include <bits/stdc++.h>
using namespace std;
long long cou = 0, ans = 0, mx = INT_MIN, mn = INT_MAX, sum = 0, modu = 1e9 + 7;
vector<vector<int>> from, to;
vector<bool> visited(1e3, false);
void dfs(int t) {
  visited[t] = true;
  for (int c = 0; c < from[t].size(); c++) {
    if (!visited[from[t][c]]) dfs(from[t][c]);
  }
}
void d(int t) {
  dfs(t);
  for (int z = 0; z < to[t].size(); z++) {
    if (!visited[to[t][z]]) d(to[t][z]);
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  int t;
  cin >> t;
  vector<pair<int, int>> v(t);
  for (long long i = 0; i < t; i++) cin >> v[i].first >> v[i].second;
  sort(v.begin(), v.end());
  if (t < 3) {
    cout << "YES";
    return 0;
  }
  int n1 = v[0].second, n2 = v[1].second;
  for (int x = 2; x < t; x++) {
    if (n1 >= v[x].first && n2 >= v[x].first) {
      cout << "NO";
      return 0;
    } else {
      if (n1 < n2)
        n1 = v[x].second;
      else
        n2 = v[x].second;
    }
  }
  cout << "YES";
  return 0;
}
