#include <bits/stdc++.h>
void solve() {
  int n, a, b, x, y;
  scanf("%d %d %d", &n, &a, &b);
  a = a > b ? a : b;
  while (--n) {
    scanf("%d %d", &x, &y);
    if (x > y) {
      int t = x;
      x = y;
      y = t;
    }
    if (y <= a)
      a = y;
    else if (x <= a)
      a = x;
    else {
      printf("NO\n");
      return;
    }
  }
  printf("YES\n");
}
int main() {
  solve();
  return 0;
}
