#include <bits/stdc++.h>
using namespace std;
const long long N = 1e5 + 50;
const long long INF = 1e9;
long long dx[] = {-1, 0, 1, 0};
long long dy[] = {0, 1, 0, -1};
template <typename T>
void __print(long long x) {
  cerr << x;
}
void __print(long x) { cerr << x; }
void __print(long long x) { cerr << x; }
void __print(unsigned x) { cerr << x; }
void __print(unsigned long x) { cerr << x; }
void __print(unsigned long long x) { cerr << x; }
void __print(float x) { cerr << x; }
void __print(double x) { cerr << x; }
void __print(long double x) { cerr << x; }
void __print(char x) { cerr << '\'' << x << '\''; }
void __print(const char *x) { cerr << '\"' << x << '\"'; }
void __print(const string &x) { cerr << '\"' << x << '\"'; }
void __print(bool x) { cerr << (x ? "true" : "false"); }
template <typename T, typename V>
void __print(const pair<T, V> &x) {
  cerr << '{';
  __print(x.first);
  cerr << ',';
  __print(x.second);
  cerr << '}';
}
template <typename T>
void __print(const T &x) {
  long long f = 0;
  cerr << '{';
  for (auto &i : x) cerr << (f++ ? "," : ""), __print(i);
  cerr << "}";
}
void _print() { cerr << "]\n"; }
template <typename T, typename... V>
void _print(T t, V... v) {
  __print(t);
  if (sizeof...(v)) cerr << ", ";
  _print(v...);
}
const long long mod = 1e9 + 7;
bool compare(const pair<long long, long long> &i,
             const pair<long long, long long> &j) {
  return i.second < j.second;
}
long long modexp(long long x, long long n) {
  long long r = 1;
  while (n) {
    if (n & 1) r = (r * x) % mod;
    x = (x * x) % mod;
    n >>= 1;
  }
  return r % mod;
}
long long modinv(long long x) { return modexp(x, mod - 2); }
vector<long long> sieve(long long n) {
  long long *arr = new long long[n + 1]();
  vector<long long> vect;
  for (long long i = 2; i <= n; i++)
    if (arr[i] == 0) {
      vect.push_back(i);
      for (long long j = 2 * i; j <= n; j += i) arr[j] = 1;
    }
  return vect;
}
long long mod_add(long long a, long long b) {
  a = a % mod;
  b = b % mod;
  return (((a + b) % mod) + mod) % mod;
}
long long mod_mul(long long a, long long b) {
  a = a % mod;
  b = b % mod;
  return (((a * b) % mod) + mod) % mod;
}
long long mod_sub(long long a, long long b) {
  a = a % mod;
  b = b % mod;
  return (((a - b) % mod) + mod) % mod;
}
long long mod_div(long long a, long long b) {
  a = a % mod;
  b = b % mod;
  return (mod_mul(a, modinv(b)) + mod) % mod;
}
void solve() {
  long long n;
  cin >> n;
  long long x, y;
  cin >> x >> y;
  long long mx = max(x, y);
  bool flag = 0;
  for (long long i = 1; i < n; i++) {
    long long a, b;
    cin >> a >> b;
    if (max(a, b) <= mx) {
      mx = max(a, b);
    } else if (min(a, b) <= mx) {
      mx = min(a, b);
    } else {
      flag = 1;
      break;
    }
  }
  if (flag)
    cout << "NO"
         << "\n";
  else
    cout << "YES"
         << "\n";
  return;
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long t = 1;
  for (long long i = 0; i < t; i++) {
    solve();
  }
  return 0;
}
