#include <bits/stdc++.h>
int n, h[110000], w[110000], H;
int main() {
  H = 0x3fffffff;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d%d", &h[i], &w[i]);
    if (h[i] < w[i]) std::swap(h[i], w[i]);
    if (h[i] <= H) {
      H = h[i];
      continue;
    }
    if (w[i] > H) {
      printf("NO\n");
      return 0;
    }
    H = w[i];
  }
  printf("YES\n");
  return 0;
}
