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