#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 5;
int a[maxn], b[maxn], s[maxn], n;
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i] >> b[i];
  int cnt = max(a[0], b[0]);
  for (int i = 1; i < n; i++) {
    if (max(a[i], b[i]) <= cnt)
      cnt = max(a[i], b[i]);
    else if (max(a[i], b[i]) > cnt && min(a[i], b[i]) <= cnt)
      cnt = min(a[i], b[i]);
    else {
      cout << "NO" << endl;
      return 0;
    }
  }
  cout << "YES" << endl;
  return 0;
}
