#include <bits/stdc++.h>
using namespace std;
long long int w[100005], h[100005];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int i, n, f, mx;
  cin >> n;
  for (i = 1; i <= n; i++) {
    cin >> w[i] >> h[i];
  }
  mx = max(w[1], h[1]);
  f = 1;
  for (i = 2; i <= n; i++) {
    if (w[i] > mx && h[i] > mx) {
      f = 0;
      break;
    } else if (w[i] <= mx && h[i] <= mx) {
      mx = max(w[i], h[i]);
    } else
      mx = min(w[i], h[i]);
  }
  if (f)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
}
