#include <bits/stdc++.h>
using namespace std;
int fin[100005];
int main() {
  int n;
  while (cin >> n) {
    int l, r;
    int flag = 1;
    int temp;
    for (int i = 0; i < n; i++) {
      cin >> l >> r;
      if (i == 0)
        fin[0] = l > r ? l : r;
      else {
        temp = l > r ? l : r;
        if (temp <= fin[i - 1])
          fin[i] = temp;
        else
          fin[i] = l < r ? l : r;
        if (fin[i] > fin[i - 1]) flag = 0;
      }
    }
    if (!flag) cout << "NO" << endl;
    if (flag) cout << "YES" << endl;
  }
}
