#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 2;
vector<pair<int, int>> v;
int n;
bool solve(int s) {
  for (int i = (n - 2); i >= 0; i--) {
    if (s <= v[i].first) {
      s = v[i].first;
    } else if (s <= v[i].second) {
      s = v[i].second;
    } else
      return false;
  }
  return true;
}
int main() {
  scanf("%d", &n);
  for (int i = 0; i < (int)(n); ++i) {
    int a, b;
    scanf("%d%d", &a, &b);
    v.push_back({min(a, b), max(b, a)});
  }
  if (solve(v[n - 1].first)) {
    puts("YES");
  } else {
    puts("NO");
  }
  return 0;
}
