#include <bits/stdc++.h>
using namespace std;
int main() {
  long long last = LONG_MAX, n, a, b;
  cin >> n;
  while (n--) {
    cin >> a >> b;
    if (last >= max(a, b)) {
      last = max(a, b);
    } else if (last >= min(a, b)) {
      last = min(a, b);
    } else {
      cout << "NO";
      return 0;
    }
  }
  cout << "YES";
}
