#include <bits/stdc++.h>
using namespace std;
long double PI = acos((long double)-1.0);
const long double eps = 1e-9;
namespace io_impl {
inline bool maybe_digit(char c) { return c >= '0' && c <= '9'; }
struct io_s {
 private:
  bool negative;
  bool ok = true;
  char ch = next_char();
  int precious;
  long double epslion;
  inline char next_char() const { return getchar(); }

 public:
  template <typename T>
  inline bool rn(T& _v) {
    negative = false;
    _v = 0;
    while (!maybe_digit(ch) && ch != EOF) {
      negative = ch == '-';
      ch = next_char();
    };
    if (ch == EOF) return ok = false;
    do {
      _v = (_v << 1) + (_v << 3) + ch - '0';
    } while (maybe_digit(ch = next_char()));
    if (negative) _v = -_v;
    return true;
  }
  template <typename T>
  inline void rn_unsafe(T& _v) {
    negative = false;
    _v = 0;
    while (!maybe_digit(ch)) {
      negative = ch == '-';
      ch = next_char();
    };
    do {
      _v = (_v << 1) + (_v << 3) + ch - '0';
    } while (maybe_digit(ch = next_char()));
    if (negative) _v = -_v;
  }
  template <typename T>
  inline T rn() {
    T v = T();
    rn_unsafe(v);
    return v;
  }
  template <typename T>
  inline bool run(T& _v) {
    _v = 0;
    while (!maybe_digit(ch) && ch != EOF) ch = next_char();
    if (ch == EOF) return ok = false;
    do {
      _v = (_v << 1) + (_v << 3) + ch - '0';
    } while (maybe_digit(ch = next_char()));
    return true;
  }
  template <typename T>
  inline void run_unsafe(T& _v) {
    _v = 0;
    while (!maybe_digit(ch)) ch = next_char();
    do {
      _v = (_v << 1) + (_v << 3) + ch - '0';
    } while (maybe_digit(ch = next_char()));
  }
  template <typename T>
  inline T run() {
    T v = T();
    run_unsafe(v);
    return v;
  }
  template <typename T>
  inline bool rd(T& _v) {
    negative = false;
    _v = 0;
    while (!maybe_digit(ch) && ch != EOF) {
      negative = ch == '-';
      ch = next_char();
    };
    if (ch == EOF) return ok = false;
    do {
      _v = (_v * 10) + (ch - '0');
    } while (maybe_digit(ch = next_char()));
    static int stk[70], tp;
    if (ch == '.') {
      tp = 0;
      T _v2 = 0;
      while (maybe_digit(ch = next_char())) {
        stk[tp++] = ch - '0';
      }
      while (tp--) {
        _v2 = _v2 / 10 + stk[tp];
      }
      _v += _v2 / 10;
    }
    if (ch == 'e' || ch == 'E') {
      ch = next_char();
      static bool _neg = false;
      if (ch == '+')
        ch = next_char();
      else if (ch == '-')
        _neg = true, ch = next_char();
      if (maybe_digit(ch)) {
        _v *= pow(10, run<long long>() * (_neg ? -1 : 1));
      }
    }
    if (negative) _v = -_v;
    return true;
  }
  template <typename T>
  inline T rd() {
    T v = T();
    rd(v);
    return v;
  }
  inline int gets(char* s) {
    char* c = s;
    while (ch == '\n' || ch == '\r' || ch == ' ') ch = next_char();
    if (ch == EOF) return (ok = false), *c = 0;
    do {
      *(c++) = ch;
      ch = next_char();
    } while (ch != '\n' && ch != '\r' && ch != ' ' && ch != EOF);
    *(c++) = '\0';
    return static_cast<int>(c - s - 1);
  }
  inline int getline(char* s) {
    char* c = s;
    while (ch == '\n' || ch == '\r') ch = next_char();
    if (ch == EOF) return (ok = false), *c = 0;
    do {
      *(c++) = ch;
      ch = next_char();
    } while (ch != '\n' && ch != '\r' && ch != EOF);
    *(c++) = '\0';
    return static_cast<int>(c - s - 1);
  }
  inline char get_alpha() {
    while (!isalpha(ch)) ch = next_char();
    const char ret = ch;
    ch = next_char();
    return ret;
  }
  inline char get_nonblank() {
    while (iswspace(ch)) ch = next_char();
    const char ret = ch;
    ch = next_char();
    return ret;
  }
  inline char get_char() {
    const char ret = ch;
    ch = next_char();
    return ret;
  }
  template <typename T>
  inline void o(T p) {
    static int stk[70], tp;
    if (p == 0) {
      putchar('0');
      return;
    }
    if (p < 0) {
      p = -p;
      putchar('-');
    }
    while (p) stk[++tp] = p % 10, p /= 10;
    while (tp) putchar(stk[tp--] + '0');
  }
  template <typename T>
  inline void od(T v) {
    static int stk[70], tp;
    tp = 0;
    if (fabs(v) < epslion / 10) {
      putchar('0');
      if (precious > 0) {
        putchar('.');
        for (int i = 0; i < precious; ++i) putchar('0');
      }
      return;
    } else {
      if (v < 0) {
        v = -v;
        putchar('-');
      }
      v += epslion / 2;
      T p = floor(v) + epslion / 10;
      while (fabs(p) > 1 - epslion) {
        stk[++tp] = fmod(p, 10), p = floor(p / 10) + epslion;
      }
      if (tp == 0) putchar('0');
      while (tp) putchar(stk[tp--] + '0');
    }
    if (precious == 0) return;
    putchar('.');
    v -= floor(v);
    for (int i = 0; i < precious; ++i) {
      v *= 10;
      putchar((int)floor(v) + '0');
      v = fmod(v, 1);
    }
  }
  typedef void io_operator(io_s& v);
  typedef char* charptr;
  template <typename T>
  inline io_s& operator>>(T& x) {
    if (numeric_limits<T>::is_signed)
      rn(x);
    else
      run(x);
    return *this;
  }
  template <typename T1, typename T2>
  inline io_s& operator>>(pair<T1, T2> pr);
  template <typename T>
  inline io_s& operator<<(const T& x);
  inline io_s& operator<<(io_operator* v) {
    v(*this);
    return *this;
  }
  operator bool() const { return ok; }
  void set_precious(int x) {
    precious = x;
    epslion = pow(10, -x);
  }
  inline int ri() { return rn<int>(); }
  inline long long rll() { return rn<long long>(); }
  inline static void new_line(io_s& v) { putchar('\n'); }
  inline static void flush(io_s& v) { fflush(stdout); }
};
template <>
inline io_s& io_s::operator>>(char*& x) {
  gets(x);
  return *this;
}
template <>
inline io_s& io_s::operator>>(float& x) {
  rd(x);
  return *this;
}
template <>
inline io_s& io_s::operator>>(double& x) {
  rd(x);
  return *this;
}
template <>
inline io_s& io_s::operator>>(long double& x) {
  rd(x);
  return *this;
}
template <typename T1, typename T2>
inline io_s& io_s::operator>>(pair<T1, T2> pr) {
  rd(pr.frist);
  rd(pr.second);
  return *this;
}
template <>
inline void io_s::o(const char p) {
  putchar(p);
}
template <>
inline void io_s::o(const char* p) {
  printf(p);
}
template <>
inline void io_s::o(float p) {
  od(p);
}
template <>
inline void io_s::o(double p) {
  od(p);
}
template <>
inline void io_s::o(long double p) {
  od(p);
}
template <typename T>
inline io_s& io_s::operator<<(const T& x) {
  o(x);
  return *this;
}
io_s::io_operator* nl = io_s::new_line;
io_s::io_operator* fl = io_s::flush;
}  // namespace io_impl
using namespace io_impl;
io_s io;
typedef void InitFunction();
typedef bool SolveFunction(int);
struct env_s {
 private:
  bool global_inited = false;
  bool case_inited = false;

 public:
  bool once() { return global_inited ? false : (global_inited = true); }
  bool every() { return case_inited ? false : (case_inited = true); }
  void fileInput() { freopen("data.in", "r", stdin); }
  void fileOutput() { freopen("data.out", "w", stdout); }
  InitFunction *_initOnce, *_init;
  template <InitFunction TInitOnce, InitFunction TInit>
  void configure() {
    _initOnce = TInitOnce;
    _init = TInit;
  }
  void init(bool global) {
    if (global)
      if (_initOnce != NULL) _initOnce();
    if (_init != NULL) _init();
  }
  void emptyInit() {}
  template <SolveFunction TSolve>
  void solveSingle() {
    global_inited = false;
    case_inited = false;
    init(true);
    TSolve(0);
  }
  template <SolveFunction TSolve>
  void solveMany() {
    global_inited = false;
    int T = io.ri();
    for (int cs = 1; T--; ++cs) {
      case_inited = false;
      init(cs == 1);
      TSolve(cs);
    }
  }
  template <SolveFunction TSolve>
  void solveMuch() {
    global_inited = false;
    case_inited = false;
    for (int cs = 1; init(cs == 1), TSolve(cs); ++cs) case_inited = false;
  }
} env;
namespace solution {
void initOnce() { io.set_precious(12); }
void init() {}
bool solve(int _cas) {
  int n;
  io >> n;
  int x = 1e9 + 7, a, aa, b, bb;
  for (int i = 0; i < n; ++i) {
    io >> a >> b;
    aa = max(a, b);
    bb = min(a, b);
    if (aa <= x)
      x = aa;
    else if (bb <= x)
      x = bb;
    else {
      puts("NO");
      return true;
    }
  }
  puts("YES");
  return true;
}
}  // namespace solution
int main() {
  env.configure<solution::initOnce, solution::init>();
  env.solveSingle<solution::solve>();
  return 0;
}
