#include <bits/stdc++.h>
using namespace std;
long long n, tab[100005][2], pop = 10000000000, nowe[100005][2];
int main() {
  cin >> n;
  for (int i = 0; n > i; i++) {
    cin >> tab[i][0] >> tab[i][1];
  }
  for (int i = 0; n > i; i++) {
    nowe[i][0] = min(tab[i][0], tab[i][1]);
    nowe[i][1] = max(tab[i][0], tab[i][1]);
  }
  for (int i = 0; n > i; i++) {
    if (nowe[i][1] <= pop)
      pop = nowe[i][1];
    else if (nowe[i][0] <= pop)
      pop = nowe[i][0];
    else {
      cout << "NO";
      return 0;
    }
  }
  cout << "YES\n";
}
