#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9 + 5;
const long long LINF = 1e18 + 5;
const double eps = 1e-9;
fstream fin, fout;
int main() {
  int n;
  cin >> n;
  vector<pair<int, int> > q(n);
  for (int i = 0; i < n; i++) {
    int a, b;
    cin >> a >> b;
    q[i] = {a, b};
  }
  int l = INF;
  bool d = 1;
  for (int i = 0; i < n && d; i++) {
    int j = max(q[i].first, q[i].second);
    if (j <= l)
      l = j;
    else {
      j = min(q[i].first, q[i].second);
      if (j <= l)
        l = j;
      else
        d = 0;
    }
  }
  if (d)
    cout << "YES";
  else
    cout << "NO";
}
