#include <bits/stdc++.h>
using namespace std;
int n, last = 1e9;
int main() {
  scanf("%d ", &n);
  for (int i = 1; i <= n; i++) {
    int w, h;
    scanf("%d %d ", &w, &h);
    if (h < w) swap(h, w);
    if (last >= h) {
      last = h;
      continue;
    }
    if (last >= w) {
      last = w;
      continue;
    } else {
      cout << "NO";
      return 0;
    }
  }
  cout << "YES";
}
