#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int a, h, x, y;
  bool flag = false;
  for (int i = 0; i < n; i++) {
    cin >> x >> y;
    if (flag) continue;
    if (i == 0)
      h = max(x, y);
    else {
      a = max(x, y);
      if (a <= h)
        h = a;
      else {
        a = min(x, y);
        if (a <= h)
          h = a;
        else
          flag = true;
      }
    }
  }
  if (flag)
    cout << "NO" << endl;
  else
    cout << "YES" << endl;
  return 0;
}
