#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 50;
const int inf = 0x3f3f3f3f;
const int mod = 1e9 + 7;
long long fpow(long long n, long long k, long long p = mod) {
  long long r = 1;
  for (; k; k >>= 1) {
    if (k & 1) r = r * n % p;
    n = n * n % p;
  }
  return r;
}
long long inv(long long a, long long p = mod) { return fpow(a, p - 2, p); }
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  long long tmp = 0;
  for (int i = 1; i <= n; i++) {
    long long x, y;
    cin >> x >> y;
    if (i == 1)
      tmp = max(x, y);
    else {
      long long mx = max(x, y);
      long long mi = min(x, y);
      if (mx <= tmp)
        tmp = mx;
      else if (mi <= tmp)
        tmp = mi;
      else {
        cout << "NO" << endl;
        return 0;
      }
    }
  }
  cout << "YES" << endl;
  return 0;
}
