#include <bits/stdc++.h>
using namespace std;
long long h[1000005];
long long w[1000005];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%lld%lld", &w[i], &h[i]);
  int mm = max(w[0], h[0]);
  for (int i = 1; i < n; i++) {
    if (mm >= min(w[i], h[i])) {
      if (mm >= max(w[i], h[i]))
        mm = max(w[i], h[i]);
      else
        mm = min(w[i], h[i]);
    } else {
      puts("NO");
      return 0;
    }
  }
  puts("YES");
}
