#include <bits/stdc++.h>
using namespace std;
long long w[100007];
long long h[100007];
int main() {
  long long n, s = 1e9 + 7;
  scanf("%I64d", &n);
  ;
  for (int i = 1; i <= n; ++i) {
    scanf("%I64d", &w[i]);
    ;
    scanf("%I64d", &h[i]);
    ;
    if (min(w[i], h[i]) > s) {
      printf("NO\n");
      return 0;
    } else if (max(w[i], h[i]) <= s)
      s = max(w[i], h[i]);
    else
      s = min(w[i], h[i]);
  }
  printf("YES\n");
  return 0;
}
