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