#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int a[n], b[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i] >> b[i];
  }
  int second = max(a[0], b[0]);
  for (int i = 0; i < n; i++) {
    vector<int> V(2);
    V[0] = a[i];
    V[1] = b[i];
    sort(V.begin(), V.end());
    if (V[1] <= second) {
      second = V[1];
      continue;
    }
    if (V[0] <= second) {
      second = V[0];
      continue;
    }
    cout << "NO";
    return 0;
  }
  cout << "YES";
  return 0;
}
