#include <bits/stdc++.h>
using namespace std;
using PII = pair<int, int>;
static auto __________2333__________ = []() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  return 0;
}();
template <typename T>
void PRINTC(const T& a) {
  cout << a << " ";
}
template <typename T>
void PRINT_CONTAINER(const T& c) {
  for (auto x : c) PRINTC(x);
  cout << "\n";
}
template <typename T>
void PRINTV(const vector<T>& c) {
  PRINT_CONTAINER<vector<T>>(c);
}
template <typename T>
void PRINTA(const T ar[], int n) {
  for (int i = 0; i < n; ++i) PRINTC(ar[i]);
  cout << "\n";
}
template <typename T1, typename T2>
void PRINTP(const pair<T1, T2>& p) {
  PRINTC(p.first);
  PRINTLN(p.second);
}
template <typename T>
void PRINTLN(const T& a) {
  cout << a << "\n";
}
template <typename T1, typename T2>
void PRINTAV(T1& vec, T2 x) {
  ostream_iterator<T2> O(cout, " ");
  copy(begin(vec), end(vec), O);
  cout << "\n";
}
int main(void) {
  int n;
  while (cin >> n) {
    int w, h, ph;
    bool mark = true;
    ph = INT_MAX;
    for (int i = 0; i < n; ++i) {
      cin >> w >> h;
      if (h < w) swap(w, h);
      if (h <= ph) {
        ph = h;
      } else if (w <= ph) {
        ph = w;
      } else {
        mark = false;
      }
    }
    if (mark)
      PRINTLN("YES");
    else
      PRINTLN("NO");
  }
  return 0;
}
