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