#define STOPIT
#include <bits/stdc++.h>
#define loop(n) for (int ngtkana_is_a_genius = 0; ngtkana_is_a_genius < int(n); ngtkana_is_a_genius++)
#define rep(i, begin, end) for (int i = int(begin); (i) < int(end); i++)
#define all(v) v.begin(), v.end()
#define rand(l, r) std::uniform_int_distribution<>(l, r)(mt)
using lint = long long;
auto mt = std::mt19937_64(std::random_device{}());
auto cmn = [](auto& a, auto b){ if (a > b) {a = b; return true;} return false; };
auto cmx = [](auto& a, auto b){ if (a < b) {a = b; return true;} return false; };
void debug_impl() { std::cerr << std::endl; }
template <typename Head, typename... Tail>
void debug_impl(Head head, Tail... tail) { std::cerr << " " << head; debug_impl(tail...); }
#ifndef STOPIT
#define debug(...)\
  do {\
    std::cerr << std::boolalpha << "[" << #__VA_ARGS__ << "]:";\
    debug_impl(__VA_ARGS__);\
    std::cerr << std::noboolalpha;\
  } while (false)
#else
#define debug(...) {}
#endif

template < typename Container, typename Value = typename Container::value_type, std::enable_if_t<!std::is_same< Container, std::string >::value, std::nullptr_t> = nullptr>
std::istream& operator>> (std::istream& is, Container& v)
  { for (auto & x : v) { is >> x; } return is; }

template < typename Container, typename Value = typename Container::value_type, std::enable_if_t<!std::is_same< Container, std::string >::value, std::nullptr_t> = nullptr >
std::ostream& operator<< (std::ostream& os, Container const& v) {
 os << "{";
  for (auto it = v.begin(); it != v.end(); it++)
    {os << (it != v.begin() ? "," : "") << *it;}
  return os << "}";
}

template < template < typename ... > class Tuple,  typename... Args, std::size_t ... Inds, std::size_t = std::tuple_size< Tuple < Args ... > >::value >
std::istream& tuple_input_impl(std::istream& os, Tuple<Args...>& tuple, std::integer_sequence<std::size_t, Inds...>)
  { (void)std::initializer_list<int>{((void)(os >> std::get< Inds >(tuple)), 0)...}; return os; }
template < template < typename ... > class Tuple,  typename... Args, std::size_t = std::tuple_size< Tuple < Args ... > >::value >
std::istream& operator>> (std::istream& os, Tuple<Args...>& tuple)
  { return tuple_input_impl(os, tuple, std::index_sequence_for<Args...>()); }

template < template < typename ... > class Tuple,  typename... Args, std::size_t ... Inds, std::size_t = std::tuple_size< Tuple < Args ... > >::value >
std::ostream& tuple_output_impl(std::ostream& os, const Tuple<Args...>& tuple, std::integer_sequence<std::size_t, Inds...>)
  { os << "("; (void)std::initializer_list<int>{((void)(os << (Inds > 0 ? "," : "") << std::get< Inds >(tuple)), 0)...}; return os << ")"; }
template < template < typename ... > class Tuple,  typename... Args, std::size_t = std::tuple_size< Tuple < Args ... > >::value >
std::ostream& operator<< (std::ostream& os, const Tuple<Args...>& tuple)
 { return tuple_output_impl(os, tuple, std::index_sequence_for<Args...>()); }

template < std::size_t I, typename Container,
  typename Value = typename std::tuple_element_t< I, typename Container::value_type >>
inline auto project(Container const& v) {
  std::vector< Value > ret(v.size());
  std::transform(v.begin(), v.end(), ret.begin(), [](auto&& t){ return std::get< I >(t); });
  return ret;
}

void err() { std::cout << "NO" << std::endl; exit(0); }
#define require(exp) do { if (!(exp)) { err(); } } while(false)

int main() {
  std::cin.tie(0); std::cin.sync_with_stdio(false);
  lint h, w; std::cin >> h >> w;
  int n; std::cin >> n;
  std::vector<std::pair<lint, int>> a;

  auto cal = [&] (lint i, lint j) {
    if (0 < i && i < h && 0 < j && j < w) return -1ll;
    if (j == 0) return i;
    if (i == h) return h + j;
    if (j == w) return 2*h + w - i;
    if (i == 0) return 2*h + 2*w - j;
    throw;
  };
  rep(t,0,n) {
    lint i0, j0, i1, j1;
    std::cin >> i0 >> j0 >> i1 >> j1;
    lint u = cal(i0,j0), v = cal(i1,j1);
    if (u == -1 || v == -1) continue;
    a.emplace_back(u,t);
    a.emplace_back(v,t);
  }
  std::sort(all(a));
  auto b = project<1>(a);
  debug(b);

  if (b.empty()) {
    std::cout << "YES" << std::endl;
    return 0;
  }

  int sz = b.size();
  std::vector<int> prt(n+1,-2);
  assert(!b.empty());
  debug(b);
  int now = n;
  rep(i,0,sz) {
    int crr = b.at(i);

    int p = prt.at(crr);
    if (p == -2) {
      int tmp = now;
      now = crr;
      prt.at(now) = tmp;
    } else {
      require(now == crr);
      now = prt.at(now);
    }
    debug(now);
  }
  debug(prt);

  std::cout << "YES" << std::endl;
  return 0;
}

Measured memory_bytes: 6384