#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  vector<pair<int, int>> v(n);
  for (int i = 0; i < (int)n; i++) {
    cin >> v[i].first >> v[i].second;
    if (v[i].second > v[i].first) swap(v[i].first, v[i].second);
  }
  int yes = true;
  int curHeight = 2000000000;
  for (int i = 0; i < n && yes; i++) {
    if (v[i].first <= curHeight)
      curHeight = v[i].first;
    else {
      if (v[i].second <= curHeight)
        curHeight = v[i].second;
      else
        yes = false;
    }
  }
  string ans = yes ? "YES" : "NO";
  cout << ans << endl;
  return 0;
}
