#include <bits/stdc++.h>
using namespace std;
vector<pair<int, int> > v;
vector<int> v1;
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    int a, b;
    cin >> a >> b;
    v.push_back(make_pair(min(a, b), max(a, b)));
  }
  for (int i = 0; i < n; i++) {
    if (i == 0) {
      v1.push_back(v[i].second);
    } else {
      int x = v1[i - 1];
      if (x >= v[i].second) {
        v1.push_back(v[i].second);
      } else
        v1.push_back(v[i].first);
    }
  }
  for (int i = 0; i < n - 1; i++) {
    if (v1[i] < v1[i + 1]) {
      cout << "NO";
      return 0;
    }
  }
  cout << "YES";
}
