#include <bits/stdc++.h>
using namespace std;
long long a[100001], b[100001], mx;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  long long n;
  cin >> n;
  for (long long i = 0; i < n; i++) {
    cin >> a[i] >> b[i];
    if (b[i] > a[i]) swap(a[i], b[i]);
  }
  mx = max(a[0], b[0]);
  for (long long i = 1; i < n; i++) {
    if (mx >= a[i])
      mx = a[i];
    else if (mx >= b[i])
      mx = b[i];
    else
      return cout << "NO", 0;
  }
  cout << "YES";
  return 0;
}
