#include <bits/stdc++.h>
using namespace std;
vector<pair<int, int> > vec;
bool isVow(char ch) {
  bool ret = false;
  if (ch == 'a' || ch == 'e' || ch == 'i' || ch == 'o' || ch == 'u') ret = true;
  return ret;
}
int main(void) {
  ios::sync_with_stdio(false), cout.tie(NULL), cin.tie(NULL);
  int n;
  cin >> n;
  int i;
  for (i = 0; i < n; ++i) {
    int x, y;
    cin >> x >> y;
    vec.push_back(make_pair(x, y));
  }
  int h = max(vec[0].first, vec[0].second);
  for (i = 1; i < n; ++i) {
    pair<int, int> a = vec[i];
    int max_v = max(a.first, a.second);
    int min_v = min(a.first, a.second);
    if (h < max_v && h < min_v) return !printf("NO");
    if (h >= max_v)
      h = max_v;
    else
      h = min_v;
  }
  printf("YES");
}
