#include <bits/stdc++.h>
using namespace std;
int main() {
  int tc, w, h, flag = 0, a, b;
  cin >> tc;
  for (int i = 1; i <= tc; i++) {
    cin >> w >> h;
    if (w > h) swap(h, w);
    if (i > 1) {
      if (b < h && b >= w) {
        int t = w;
        w = h;
        h = t;
      } else if (b < w && b < h) {
        flag = 1;
      }
    }
    a = w, b = h;
  }
  if (flag == 1)
    puts("NO");
  else
    puts("YES");
}
