#include <bits/stdc++.h>
using namespace std;
struct rec {
  int w, h;
};
vector<rec> v;
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    int w, h;
    scanf("%d %d", &w, &h);
    v.push_back({w, h});
  }
  int last = -0x3f3f3f3f;
  for (int i = n; i > 0; i--) {
    int prev = max(v[i - 1].w, v[i - 1].h);
    int mini = min(v[i].h, v[i].w);
    int maxi = max(v[i].h, v[i].w);
    if (mini >= last && mini <= prev) {
      last = mini;
    } else if (maxi >= last && maxi <= prev) {
      last = maxi;
    } else {
      printf("NO\n");
      return 0;
    }
  }
  printf("YES\n");
  return 0;
}
