#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  scanf("%d", &n);
  int index;
  for (int i = 1; i <= n; i++) {
    int a, b;
    scanf("%d%d", &a, &b);
    int maxn = max(a, b);
    int minn = min(a, b);
    if (i == 1) {
      index = maxn;
      continue;
    }
    if (minn > index) {
      printf("NO\n");
      return 0;
    } else {
      if (maxn <= index) {
        index = maxn;
      } else if (minn <= index) {
        index = minn;
      }
    }
  }
  printf("YES\n");
}
