#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
typedef pair<int, int> ii;
typedef vector<ii> vii;

int lgt, wth, pm, nPt;
vii rg;

bool onEdge (int r, int c) {
  bool ote = false;
  ote |= r == 0;
  ote |= c == 0;
  ote |= r == lgt;
  ote |= c == wth;
  return ote;
}

int unID (int r, int c) {
  if (r == 0) return c;
  if (c == 0) return pm - r;
  if (r == lgt) return pm - (lgt) - c;
  if (c == wth) return (wth - 1) + r;
  return 10000;
}

int main() {
  scanf("%d%d%d", &lgt, &wth, &nPt);
  pm = 2 * (lgt + wth);
  int nCE = 0;
  for (int i = 0; i < nPt; i++) {
    int a, b, p, q;
    scanf("%d%d%d%d", &a, &b, &p, &q);

    if (onEdge(a, b) && onEdge(p, q)) {
      nCE++;
      int s = unID(a, b);
      int t = unID(p, q);
      if (s > t) swap(s, t);
      rg.eb(s, nCE);
      rg.eb(t, -nCE);
      // printf(">>%d %d\n", s, t);
    }
  }
  sort(rg.begin(), rg.end());
  stack<int> st;
  st.push(0);
  for (ii el : rg) {
    // printf("%d %d\n", el.fi, el.se);
    if (el.se > 0) st.push(el.se);
    if (el.se + st.top() == 0) {
      st.pop();
    }
  }
  st.pop();
  if (st.empty()) printf("YES\n");
  if (!st.empty()) printf("NO\n");
}