#include <bits/stdc++.h>
using namespace std;
int main() {
  long long last, x, y;
  int n, f = 0;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> x >> y;
    if (i == 0) last = max(x, y);
    if (last >= max(x, y)) {
      last = max(x, y);
    } else if (last >= min(x, y)) {
      last = min(x, y);
    } else {
      cout << "NO" << endl;
      return 0;
    }
  }
  cout << "YES" << endl;
}
