#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("avx,avx2,fma")
using namespace std;
void gh() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}
void solve() {
  gh();
  long long int they, p = 0;
  cin >> they;
  while (they--) {
    long long int x, y;
    cin >> x >> y;
    if (p == 0) {
      p = max(x, y);
    } else {
      if (p >= max(x, y)) {
        p = max(x, y);
      } else if (p >= min(x, y)) {
        p = min(x, y);
      } else {
        cout << "NO";
        return;
      }
    }
  }
  cout << "YES";
}
int main() {
  long long int we = 1;
  while (we--) {
    solve();
  }
}
