#include <bits/stdc++.h>
using namespace std;
long long int modular(long long int n, long long int pow, long long int N) {
  long long int res = 1;
  while (pow) {
    if (pow & 1) res = (res % N * n % N) % N;
    n = (n % N * n % N) % N;
    pow = pow / 2;
  }
  return res;
}
long long int d, x, y;
void extendedEuclid(long long int A, long long int B) {
  if (B == 0) {
    d = A;
    x = 1;
    y = 0;
  } else {
    extendedEuclid(B, A % B);
    long long int temp = x;
    x = y;
    y = temp - (A / B) * y;
  }
}
long long int modInverse(long long int A, long long int N) {
  extendedEuclid(A, N);
  return (x % N + N) % N;
}
int main() {
  long long int n, i;
  cin >> n;
  vector<pair<long long int, long long int>> v;
  for (i = 0; i < n; i++) {
    long long int x, y;
    cin >> x >> y;
    v.push_back({x, y});
  }
  long long int ans = min(v[n - 1].first, v[n - 1].second);
  long long int flag = 0;
  for (i = n - 2; i >= 0; i--) {
    if (v[i].second >= ans && v[i].first >= ans)
      ans = min(v[i].second, v[i].first);
    else if (v[i].second >= ans)
      ans = v[i].second;
    else if (v[i].first >= ans)
      ans = ans = v[i].first;
    else {
      flag = 1;
      break;
    }
  }
  if (flag == 1)
    cout << "NO" << endl;
  else
    cout << "YES" << endl;
}
