#include <bits/stdc++.h>
using namespace std;

typedef long long ll;

ll R, C, N;
map<ll, ll> Pairs;

ll pos(ll x, ll y) {
  if (y == 0) return x;
  if (x == R) return R + y;
  if (y == C) return R + C + (R - x);
  if (x == 0) return R + C + R + (C - y);
  return -1;
}
bool solve() {
  stack<ll> s;
  for (auto ab : Pairs) {
    ll a, b;
    tie(a, b) = ab;
    if (!s.empty() && s.top() == b)
      s.pop();
    else
      s.push(a);
  }
  return s.empty();
}
int main() {
  cin >> R >> C >> N;
  for (ll i = 0; i < N; ++i) {
    ll x, y, x2, y2;
    cin >> x >> y >> x2 >> y2;
    ll a = pos(x, y), b = pos(x2, y2);
    if (a < 0 || b < 0) continue;
    Pairs[a] = b;
    Pairs[b] = a;
  }
  cout << (solve() ? "YES" : "NO") << endl;
  return 0;
}
