#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  int a[n], b[n];
  for (int i = 0; i < n; i++) cin >> a[i] >> b[i];
  bool poss = true;
  if (a[0] > b[0]) swap(a[0], b[0]);
  for (int i = 1; i < n; i++) {
    if (a[i] > b[i]) swap(a[i], b[i]);
    if (b[i] > b[i - 1]) {
      swap(b[i], a[i]);
    }
    if (b[i] > b[i - 1]) {
      poss = false;
      break;
    }
  }
  if (poss)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
}
