#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e6 + 10;
const long long INF = 0x3f3f3f3f;
const long long MOD = 1e9 + 7;
const double eps = 1e-8;
int n, m, k;
int main(void) {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << setprecision(10) << fixed;
  cin >> n;
  int last = INF;
  for (int i = 0; i < n; i++) {
    int a, b;
    cin >> a >> b;
    if (a < b) swap(a, b);
    if (last >= a)
      last = a;
    else if (last >= b)
      last = b;
    else {
      last = 0;
      break;
    }
  }
  if (last)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
  cerr << "execute time : " << (double)clock() / CLOCKS_PER_SEC << endl;
  return 0;
}
