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