#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int arr[n + 1];
  int x, y;
  cin >> x >> y;
  arr[0] = max(x, y);
  for (int i = 1; i < n; i++) {
    x, y;
    cin >> x >> y;
    if (max(x, y) <= arr[i - 1]) {
      arr[i] = max(x, y);
    } else {
      arr[i] = min(x, y);
    }
  }
  cout << endl;
  bool t = true;
  for (int i = 0; i < n - 1; i++) {
    if (arr[i] - arr[i + 1] < 0) {
      t = false;
      break;
    }
  }
  if (t) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
  return 0;
}
