#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  cin >> n;
  long long x[n + 1000], y[n + 1000];
  vector<long long> v;
  for (long long i = 1; i <= n; ++i) {
    cin >> x[i] >> y[i];
  }
  long long MX = max(x[1], y[1]);
  for (long long i = 2; i <= n; ++i) {
    if (MX >= x[i] && MX >= y[i]) {
      MX = max(x[i], y[i]);
    } else if (MX >= x[i])
      MX = x[i];
    else if (MX >= y[i])
      MX = y[i];
    else {
      cout << "NO\n";
      return 0;
    }
  }
  cout << "YES\n";
}
