#include <bits/stdc++.h>
using namespace std;
int n, p = pow(10, 9) + 20;
int main() {
  cin >> n;
  while (n--) {
    int x, y;
    cin >> x >> y;
    if (max(x, y) <= p)
      p = max(x, y);
    else if (min(x, y) <= p)
      p = min(x, y);
    else
      return cout << "NO", 0;
  }
  cout << "YES";
  return 0;
}
