#include <bits/stdc++.h>
using namespace std;
const int MAXX = 1e5 + 10;
int n, a[MAXX], b[MAXX];
int main() {
  ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i] >> b[i];
  for (int i = 0; i < n - 1; i++) {
    if (i && max(a[i], b[i]) > max(a[i - 1], b[i - 1]))
      a[i] = min(a[i], b[i]), b[i] = a[i];
    if (max(a[i], b[i]) < min(a[i + 1], b[i + 1]))
      return cout << "NO" << endl, 0;
  }
  return cout << "YES" << endl, 0;
}
