#include <bits/stdc++.h>
using namespace std;
struct {
  int width, height;
} rec[100000];
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> rec[i].width >> rec[i].height;
  }
  bool judge = true;
  rec[0].height = max(rec[0].width, rec[0].height);
  for (int i = 1; i < n; i++) {
    int Max = max(rec[i].height, rec[i].width),
        Min = min(rec[i].height, rec[i].width);
    if (Max <= rec[i - 1].height) {
      rec[i].height = Max;
    } else if (Min <= rec[i - 1].height) {
      rec[i].height = Min;
    } else {
      judge = false;
      break;
    }
  }
  if (judge) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
  return 0;
}
