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