#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int a[n], h[n];
  vector<int> v;
  v.push_back(1000000000 + 1);
  for (int i = 0; i < n; i++) {
    cin >> a[i] >> h[i];
  }
  for (int i = 0; i < n; i++) {
    int mx = max(h[i], a[i]);
    if (v.back() >= mx) {
      v.push_back(mx);
    } else if (v.back() >= min(h[i], a[i])) {
      v.push_back(min(h[i], a[i]));
    } else {
      cout << "NO";
      return 0;
    }
  }
  cout << "YES";
  return 0;
}
