#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  int n;
  cin >> n;
  int w, h;
  cin >> w >> h;
  int mn = min(w, h), mx = max(w, h);
  int ans = mx;
  n--;
  bool flag = 1;
  while (n--) {
    cin >> w >> h;
    if (max(w, h) > ans && min(w, h) > ans) {
      flag = 0;
    } else if (max(w, h) > ans && min(w, h) <= ans) {
      ans = min(w, h);
    } else
      ans = max(w, h);
  }
  if (flag)
    cout << "YES";
  else
    cout << "NO";
}
