#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int h[n + 5], w[n + 5];
  for (int i = 0; i < n; i++) {
    int x, y;
    cin >> x >> y;
    w[i] = x;
    h[i] = y;
  }
  int prev = max(h[0], w[0]);
  int pre;
  for (int i = 1; i < n; i++) {
    pre = max(h[i], w[i]);
    if (prev < pre) {
      if (prev >= min(h[i], w[i])) {
        prev = min(h[i], w[i]);
      } else {
        cout << "NO" << endl;
        return 0;
      }
    } else {
      prev = pre;
    }
  }
  cout << "YES" << endl;
  return 0;
}
