#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  pair<int, int> p[n];
  for (int i = 0; i < n; i++) {
    cin >> p[i].first >> p[i].second;
  }
  int a = p[0].first, b = p[0].second;
  p[0].first = min(a, b);
  p[0].second = max(a, b);
  for (int i = 1; i < n; i++) {
    if (max(p[i].first, p[i].second) <= p[i - 1].second) {
      p[i].second = max(p[i].first, p[i].second);
    } else {
      p[i].second = min(p[i].first, p[i].second);
    }
  }
  bool flag = true;
  for (int i = 1; i < n; i++) {
    if (p[i].second > p[i - 1].second) flag = false;
  }
  if (flag)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
}
