#include <bits/stdc++.h>
using namespace std;
const int mxn = 100010;
int read() {
  int x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
int R, C;
int n;
struct node {
  int x1, y1, x2, y2;
} a[mxn];
int cmp1(node a, node b) {
  return (a.x1 == b.x1 && a.y1 < b.y1) || a.x1 < b.x1;
}
int check(int x, int y) {
  bool flag1 = (x == R) || (x == C) || (x == 0);
  bool flag2 = (y == R) || (y == C) || (y == 0);
  return flag1 | flag2;
}
struct point {
  int x, y;
  point operator+(point b) { return (point){x + b.x, y + b.y}; }
  point operator-(point b) { return (point){x - b.x, y - b.y}; }
  int operator*(point b) { return x * b.x + y * b.y; }
};
long long Cross(point a, point b) {
  return (long long)a.x * b.y - (long long)a.y * b.x;
}
int Segcross(node x, node y) {
  int res = 0;
  point a = (point){x.x1, x.y1};
  point b = (point){x.x2, x.y2};
  point c = (point){y.x2, y.y2};
  point d = (point){y.x2, y.y2};
  return ((double)Cross(c - a, b - a) * Cross(b - a, d - a) < 0) ^
         ((double)Cross(a - d, c - d) * Cross(d - c, b - d) < 0);
}
int ban, up, down;
int main() {
  int i, j;
  R = read();
  C = read();
  n = read();
  for (i = 1; i <= n; i++) {
    a[i].x1 = read();
    a[i].y1 = read();
    a[i].x2 = read();
    a[i].y2 = read();
    if (a[i].x1 > a[i].x2) {
      swap(a[i].x1, a[i].x2);
      swap(a[i].y1, a[i].y2);
    }
    if (a[i].x1 == a[i].x2 && a[i].y1 > a[i].y2) {
      swap(a[i].y1, a[i].y2);
    }
  }
  int ed = 0;
  for (i = 1; i <= n; i++) {
    if (!check(a[i].x1, a[i].y1) || !check(a[i].x2, a[i].y2)) continue;
    a[++ed] = a[i];
  }
  sort(a + 1, a + ed + 1, cmp1);
  int mxu = 0, mxd = 0;
  for (i = 1; i <= ed; i++) {
    for (j = max(1, i - 10); j < i; j++) {
      if (Segcross(a[i], a[j])) {
        printf("NO\n");
        return 0;
      }
    }
    mxu = max(mxu, a[i].y1);
    mxd = max(mxd, a[i].y2);
  }
  printf("YES\n");
  return 0;
}
