#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 10;
const int INF = 0x3f3f3f3f;
struct REC {
  int w, h;
} rec[MAXN];
int n;
int main() {
  cin >> n;
  rec[0].h = INF;
  bool flag = true;
  for (int i = 1; i <= n; i++) {
    cin >> rec[i].w >> rec[i].h;
    if (max(rec[i].w, rec[i].h) <= rec[i - 1].h)
      rec[i].h = max(rec[i].w, rec[i].h);
    else if (min(rec[i].w, rec[i].h) <= rec[i - 1].h)
      rec[i].h = min(rec[i].w, rec[i].h);
    else if (min(rec[i].w, rec[i].h) > rec[i - 1].h)
      flag = false;
  }
  if (flag)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
  return 0;
}
