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