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