#include <bits/stdc++.h>
using namespace std;
long long n, t, a[200000], x, y;
string s;
map<char, long long> m;
vector<pair<long long, long long>> v;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n;
  for (long long i = 0; i < n; i++) {
    cin >> x >> y;
    v.push_back(make_pair(x, y));
  }
  long long pre;
  if (v[0].first >= v[0].second)
    pre = v[0].first;
  else
    pre = v[0].second;
  for (long long i = 1; i < n; i++) {
    if (v[i].first > pre && v[i].second > pre) {
      cout << "NO";
      return 0;
    }
    if (v[i].first <= pre && v[i].first > v[i].second)
      pre = v[i].first;
    else if (v[i].second <= pre && v[i].second >= v[i].first)
      pre = v[i].second;
    else if (v[i].first < v[i].second)
      pre = v[i].first;
    else if (v[i].first > v[i].second)
      pre = v[i].second;
  }
  cout << "YES";
  return 0;
}
