#include <bits/stdc++.h>
using namespace std;
int a[100010], b[100010];
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i] >> b[i];
  for (int i = 0; i < n; i++)
    if (a[i] > b[i]) swap(a[i], b[i]);
  int now = b[0];
  for (int i = 1; i < n; i++) {
    if (now >= b[i])
      now = b[i];
    else if (now >= a[i])
      now = a[i];
    else {
      cout << "NO" << endl;
      return 0;
    }
  }
  cout << "YES" << endl;
  return 0;
}
