#include <bits/stdc++.h>
using namespace std;
int main() {
  long long t;
  cin >> t;
  long long s1[t], s2[t], o = 9999999999, n, p = 0, l = 0, k, m;
  for (int i = 0; i < t; i++) {
    cin >> s1[i] >> s2[i];
    m = max(s1[i], s2[i]);
    n = min(s1[i], s2[i]);
    o = min(o, m);
    if (m > o) {
      o = min(o, n);
      if (n > o) {
        l = 1;
      }
    }
  }
  if (l == 0) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
}
