#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 10;
long w[maxn], h[maxn];
long n;
long af[maxn];
int main() {
  scanf("%ld", &n);
  long i;
  for (i = 1; i <= n; i++) {
    scanf("%ld%ld", &w[i], &h[i]);
  }
  if (n == 1) {
    printf("YES\n");
    return 0;
  }
  af[1] = max(w[1], h[1]);
  for (i = 2; i <= n; i++) {
    long lte = min(w[i], h[i]);
    long big = max(w[i], h[i]);
    if (lte > af[i - 1]) return 0 * printf("NO\n");
    if (big <= af[i - 1]) {
      af[i] = big;
      continue;
    }
    if (big > af[i - 1] && lte <= af[i - 1]) af[i] = lte;
  }
  printf("YES\n");
  return 0;
}
