#include <bits/stdc++.h>
using namespace std;
pair<int, int> arr[100001];
int main() {
  int x, y, w, h, n, i, j, prev, flag = 1;
  scanf("%d", &n);
  for (i = 0; i < n; i++) {
    scanf("%d %d", &x, &y);
    if (x >= y) {
      arr[i].second = x;
      arr[i].first = y;
    } else {
      arr[i].first = x;
      arr[i].second = y;
    }
  }
  prev = arr[0].second;
  for (i = 1; i < n; i++) {
    if (arr[i].second <= prev) {
      prev = arr[i].second;
      continue;
    } else if (arr[i].first <= prev) {
      prev = arr[i].first;
      continue;
    } else {
      flag = 0;
      break;
    }
  }
  if (flag == 1)
    printf("YES\n");
  else
    printf("NO\n");
}
