#include <bits/stdc++.h>
using namespace std;
int a[100005], b[100005];
int main() {
  ios::sync_with_stdio(false);
  cin.tie();
  cout.tie();
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i] >> b[i];
  }
  int st = a[1], fl = 0;
  for (int i = 2; i <= n; i++) {
    if (a[i] <= st && b[i] <= st) {
      st = max(a[i], b[i]);
    } else if (a[i] <= st)
      st = a[i];
    else if (b[i] <= st)
      st = b[i];
    else
      fl = 1;
  }
  if (fl == 0) {
    cout << "YES\n";
    return 0;
  }
  st = b[1], fl = 0;
  for (int i = 2; i <= n; i++) {
    if (a[i] <= st && b[i] <= st) {
      st = max(a[i], b[i]);
    } else if (a[i] <= st)
      st = a[i];
    else if (b[i] <= st)
      st = b[i];
    else
      fl = 1;
  }
  if (fl == 0) {
    cout << "YES\n";
  } else
    cout << "NO\n";
  return 0;
}
