#include <bits/stdc++.h>
using namespace std;
const int MAXN = 500010;
const int inf = 1e9 + 1e8;
const long long INF = 1e18 + 1e17;
const int MOD1 = 998244353;
const int MOD2 = 1e9 + 7;
long long gcd(long long a, long long b) { return (b == 0 ? a : gcd(b, a % b)); }
bool is_prime(int x) {
  if (x == 1 || (x % 2 == 0 && x > 2)) return false;
  for (int i = 3; i * i <= x; i += 2) {
    if (!(x % i)) {
      return false;
    }
  }
  return true;
}
bool is_palindrome(string str) {
  for (int i = 0; i < str.length() / 2; i++) {
    if (str[i] != str[str.length() - 1 - i]) {
      return false;
    }
  }
  return true;
}
long long NCR(int n, int r) {
  if (n < r || r < 0 || n <= 0) return 0;
  if (r > n / 2) return NCR(n, n - r);
  long long res = 1;
  for (long long k = 1; k <= r; k++) {
    res *= n - k + 1;
    res /= k;
  }
  return res;
}
int N, cnt, cnt_node;
pair<int, int> arr[MAXN];
vector<int> graph[MAXN];
bool visited[MAXN];
void dfs(int start) {
  visited[start] = true;
  cnt_node++;
  for (int node : graph[start]) {
    if (!visited[node]) {
      dfs(node);
    }
  }
  return;
}
int main() {
  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> arr[i].first >> arr[i].second;
  }
  sort(arr, arr + N);
  set<pair<int, int> > rights;
  for (int i = 0; i < N; i++) {
    auto it = rights.lower_bound({arr[i].first, 0});
    while (it != rights.end() && it->first < arr[i].second) {
      int node = it->second;
      graph[node].push_back(i);
      graph[i].push_back(node);
      cnt++;
      if (cnt >= N) {
        cout << "NO" << endl;
        return 0;
      }
      it++;
    }
    rights.insert(make_pair(arr[i].second, i));
  }
  dfs(0);
  if (cnt_node == N) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
  return 0;
}
