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