#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, i, j, k, l, cur = 0;
  cin >> n;
  vector<pair<int, int> > v;
  for (i = 0; i < n; i++) {
    cin >> j >> k;
    v.push_back(make_pair(j, k));
  }
  cur = max(v[0].first, v[0].second);
  int f = 1;
  for (i = 1; i < n; i++) {
    k = min(v[i].first, v[i].second);
    j = max(v[i].first, v[i].second);
    if (cur < j) {
      if (cur < k) {
        cout << "NO\n";
        return 0;
      } else
        cur = k;
    } else
      cur = j;
  }
  cout << "YES\n";
  return 0;
}
