#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n;
  cin >> n;
  long long int maxi = 1e10;
  long long int pt = 0;
  for (long long int i = 0; i < n; i++) {
    long long int x, y;
    cin >> x >> y;
    if (max(x, y) <= maxi)
      maxi = max(x, y);
    else if (min(x, y) <= maxi)
      maxi = min(x, y);
    else
      pt++;
  }
  if (pt == 0)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
}
