#include <bits/stdc++.h>
using namespace std;
long long a[100005];
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  a[0] = 10000000000;
  int z;
  bool l = true;
  cin >> z;
  for (int i = 1; i <= z; i++) {
    long long t, y;
    cin >> t >> y;
    if (max(t, y) <= a[i - 1])
      a[i] = max(t, y);
    else if (min(t, y) <= a[i - 1])
      a[i] = min(t, y);
    else
      l = false;
  }
  if (l)
    cout << "YES";
  else
    cout << "NO";
  return 0;
}
