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