#include <bits/stdc++.h>
using namespace std;
int main() {
  long int t;
  cin >> t;
  int d = 0;
  long int a[t][2];
  for (long int i = 0; i < t; i++) {
    for (long int j = 0; j < 2; j++) {
      cin >> a[i][j];
    }
  }
  for (long int i = 0; i < t; i++) {
    if (i == 0) {
      if (a[i][0] > a[i][1]) swap(a[i][0], a[i][1]);
    } else if (a[i - 1][1] >= a[i][1]) {
      if (a[i - 1][1] >= a[i][0] && a[i][0] > a[i][1]) {
        swap(a[i][0], a[i][1]);
      }
    } else if (a[i - 1][1] >= a[i][0]) {
      swap(a[i][1], a[i][0]);
    } else {
      cout << "NO" << endl;
      d = 1;
      break;
    }
  }
  if (d == 0) cout << "YES" << endl;
  return 0;
}
