#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int n, w, h;
  int w1 = -1;
  int h1 = -1;
  int max1 = -1;
  int ok = 1;
  cin >> n;
  cin >> w >> h;
  max1 = max(w, h);
  for (int i = 1; i < n; i++) {
    cin >> w >> h;
    if (max1 >= w && max1 >= h) {
      max1 = max(w, h);
    } else if (max1 >= w) {
      max1 = w;
      ;
    } else if (max1 >= h) {
      max1 = h;
    } else {
      std::cout << "NO" << std::endl;
      return 0;
    }
  }
  std::cout << "YES" << std::endl;
}
