#include <bits/stdc++.h>
using namespace std;
bool isv(char x) {
  if (x == 'a' || x == 'e' || x == 'i' || x == 'o' || x == 'u') return true;
  return false;
}
int main() {
  ios::sync_with_stdio(0);
  long long c, a, b, act;
  cin >> c;
  cin >> a >> b;
  act = max(a, b);
  --c;
  while (c--) {
    cin >> a >> b;
    if (a <= act && b <= act)
      act = max(a, b);
    else if (a <= act)
      act = a;
    else if (b <= act)
      act = b;
    else {
      cout << "NO" << '\n';
      return 0;
    }
  }
  cout << "YES" << '\n';
  return 0;
}
