#include <bits/stdc++.h>
using namespace std;
long long int power(long long int x, long long int y) {
  long long int res = 1;
  while (y > 0) {
    if (y & 1) res = (res * x);
    y = y >> 1;
    x = (x * x);
  }
  return (res);
}
bool is_powerof_2(long long int x) { return x && (!(x & (x - 1))); }
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n;
  cin >> n;
  long long int w[n], h[n];
  for (long long int i = 0; i < n; i++) cin >> w[i] >> h[i];
  if (h[0] < w[0]) swap(h[0], w[0]);
  for (long long int i = 1; i < n; i++) {
    if (h[i] < w[i]) swap(h[i], w[i]);
    if (h[i] <= h[i - 1]) continue;
    if (w[i] <= h[i - 1]) {
      swap(h[i], w[i]);
      continue;
    }
    cout << "NO\n";
    return 0;
  }
  cout << "YES\n";
}
