#include <bits/stdc++.h>
using namespace std;
const int N = 200010;
int r,c,n,cnt;
int getval(int x,int y) {
  if (x != 0 && x != r && y != 0 && y != c)
    return 0;
  if (x == 0) return y + 1;
  if (y == c) return c + 1 + x;
  if (x == r) return c + r + c - y + 1;
  if (y == 0) return c + r + c + r - x + 1; 
  assert(0);
}
struct data {
  int val,id;
  bool operator < (const data& x) const {
    return val < x.val;
  }
} dat[N];
int sta[N],top,vis[N];
int main() {
  int x,y,a,b;
  scanf("%d%d%d",&r,&c,&n);
  for (int i = 1 ; i <= n ; ++ i) {
    scanf("%d%d",&x,&y);
    a = getval(x,y);
    scanf("%d%d",&x,&y);
    b = getval(x,y);
    if (a && b) {
      dat[++cnt] = (data) {a,i};
      dat[++cnt] = (data) {b,i};
    }
  }
  sort(dat+1,dat+cnt+1);
  for (int i = 1 ; i <= cnt ; ++ i) {
    if (!vis[dat[i].id]) sta[++top] = dat[i].id, vis[dat[i].id] = 1;
    else {
      if (sta[top] == dat[i].id) top--;
      else return 0 * printf("NO\n");
    }
  }
  printf("YES\n");
  return 0;
}