#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  long long w, h, wp = 1 << 30, hp = 1 << 30;
  bool res = true;
  for (int i = 1; i <= n; ++i) {
    cin >> w >> h;
    if (w > h && w <= hp) {
      swap(w, h);
      hp = h;
      continue;
    }
    if (h <= hp) {
      hp = h;
      continue;
    }
    if (w <= h && w <= hp) {
      swap(w, h);
      hp = h;
      continue;
    }
    res = false;
  }
  if (res)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
  return 0;
}
