#include <bits/stdc++.h>
using namespace std;
int main() {
  bool flag = false;
  int n, boro;
  cin >> n;
  int a[n], b[n];
  for (int i = 0; i < n; i++) cin >> a[i] >> b[i];
  for (int i = 0; i < 1; i++) {
    boro = max(a[i], b[i]);
  }
  for (int i = 1; i < n; i++) {
    if (max(a[i], b[i]) <= boro) {
      boro = max(a[i], b[i]);
    } else if (min(a[i], b[i]) <= boro) {
      boro = min(a[i], b[i]);
    } else {
      flag = true;
      break;
    }
  }
  if (flag == false)
    cout << "YES\n";
  else
    cout << "NO\n";
  return 0;
}
