#include <bits/stdc++.h>
using namespace std;
signed main() {
  long long flag = 1;
  long long n;
  cin >> n;
  pair<long long, long long> a[n];
  for (long long i = 0; i < n; i++) {
    cin >> a[i].first >> a[i].second;
  }
  if (a[0].first > a[0].second) swap(a[0].first, a[0].second);
  for (long long i = 1; i < n; i++) {
    long long x = min(a[i].first, a[i].second);
    long long y = max(a[i].first, a[i].second);
    if (a[i - 1].second < x && a[i - 1].second < y) {
      flag = 0;
      break;
    } else {
      if (a[i - 1].second >= y)
        a[i].second = y;
      else
        a[i].second = x;
    }
  }
  if (flag)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
}
