#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<pair<long long, long long> > V;
  long long n, i, j;
  long long mx = 1e9 + 11, f = 1;
  cin >> n;
  for (i = 0; i < n; i++) {
    long long x, y;
    cin >> x >> y;
    if (x > y)
      V.push_back(make_pair(x, y));
    else
      V.push_back(make_pair(y, x));
  }
  for (i = 0; i < n; i++) {
    if (V[i].first <= mx)
      mx = V[i].first;
    else {
      if (V[i].second <= mx)
        mx = V[i].second;
      else
        f = 0;
    }
  }
  puts(f ? "YES" : "NO");
  return 0;
}
