#include <bits/stdc++.h>
long long gcd(long long a, long long b) {
  if (b == 0) {
    return a;
  }
  return gcd(b, a % b);
}
using namespace std;
long long BigMod(long long B, long long P, long long M) {
  long long R = 1;
  while (P > 0) {
    if (P % 2 == 1) {
      R = (R * B) % M;
    }
    P /= 2;
    B = (B * B) % M;
  }
  return R;
}
long long histogram(long long arr[], long long n) {
  stack<int> s;
  int area = 0, i = 0;
  while (i < n) {
    if (s.empty() || arr[s.top()] <= arr[i])
      s.push(i++);
    else {
      int tp = s.top();
      s.pop();
      int xx = arr[tp] * (s.empty() ? i : i - s.top() - 1);
      area = max(area, xx);
    }
  }
  while (!s.empty()) {
    int tp = s.top();
    s.pop();
    int xx = arr[tp] * (s.empty() ? i : i - s.top() - 1);
    area = max(area, xx);
  }
  return area;
}
long long dp[2000010], arr[2000010];
char str[2000010];
int main() {
  long long n, m, k, a, b;
  long long sum = 0;
  string s;
  cin >> n;
  cin >> a >> b;
  m = max(a, b);
  for (int i = 0; i < n - 1; i++) {
    cin >> a >> b;
    if (a > b) {
      if (a <= m)
        m = a;
      else if (m < b) {
        cout << "NO" << endl;
        return 0;
      } else
        m = b;
    } else {
      if (b <= m)
        m = b;
      else if (m < a) {
        cout << "NO" << endl;
        return 0;
      } else
        m = a;
    }
  }
  cout << "YES" << endl;
  return 0;
}
