#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  pair<int, int> *rec;
  cin >> n;
  rec = new pair<int, int>[n];
  for (int i = 0; i < n; i++) {
    int w, h;
    cin >> w >> h;
    rec[i] = {w, h};
  }
  int prev = max(rec[0].first, rec[0].second);
  bool possible = true;
  for (int i = 1; i < n; i++) {
    int hi = max(rec[i].first, rec[i].second);
    int lo = min(rec[i].first, rec[i].second);
    if (hi <= prev) {
      prev = hi;
    } else if (lo <= prev) {
      prev = lo;
    } else {
      possible = false;
      break;
    }
  }
  cout << (possible ? "YES\n" : "NO\n");
}
