#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int i = 0, j = 0, n, a, b, m, d, e = 0, c = -1000000000000000000,
                t = 0, x, y, f = 0, o, k = 0, z = 0, h = 0, l = 0, x1, x2, y1,
                y2;
  cin >> n;
  vector<pair<long long int, long long int>> v;
  for (i = 0; i < n; i++) {
    cin >> x >> y;
    v.push_back(make_pair(x, y));
  }
  for (i = 0; i < n; i++) {
    if (i == 0) {
      c = max(v[i].first, v[i].second);
    } else {
      d = max(v[i].first, v[i].second);
      if (d <= c)
        c = d;
      else {
        d = min(v[i].first, v[i].second);
        if (d <= c)
          c = d;
        else {
          z = 1;
          cout << "NO" << endl;
          break;
        }
      }
    }
  }
  if (z == 0) cout << "YES";
}
