#include <bits/stdc++.h>
using namespace std;
void Solve() {
  long long n;
  cin >> n;
  vector<long long> a(n);
  long long q, p;
  cin >> q >> p;
  a[0] = max(q, p);
  for (long long i = 1; i < n; ++i) {
    cin >> q >> p;
    a[i] = max(q, p);
    if (a[i] > a[i - 1]) a[i] = min(q, p);
    if (a[i] > a[i - 1]) return void(cout << "NO");
  }
  cout << "YES";
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  Solve();
  return 0;
}
