#include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1);
const int mod = 1e9 + 7;
template <typename T>
inline T read() {
  T s = 0, f = 1;
  char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (isdigit(ch)) {
    s = (s << 3) + (s << 1) + ch - 48;
    ch = getchar();
  }
  return s * f;
}
template <typename T>
inline void print(T x) {
  if (x < 0) putchar('-'), x = -x;
  if (x > 9) print(x / 10);
  putchar(x % 10 + '0');
}
const int maxx = 1e5 + 10;
int n;
struct node {
  int x;
  int y;
} a[maxx];
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i].x >> a[i].y;
  }
  int cnt = max(a[1].x, a[1].y);
  int flag = 1;
  for (int i = 2; i <= n; i++) {
    int l = max(a[i].x, a[i].y);
    int r = min(a[i].x, a[i].y);
    if (l <= cnt) {
      cnt = l;
      continue;
    } else {
      if (r <= cnt) {
        cnt = r;
        continue;
      } else {
        flag = 0;
        break;
      }
    }
  }
  if (flag)
    puts("YES");
  else
    puts("NO");
  return 0;
}
