#include <bits/stdc++.h>
const int N=200050;
using namespace std;
inline int gi(){
  char ch=getchar();int x=0,q=0;
  while(ch<'0' || ch>'9') ch=='-'?q=1:0,ch=getchar();
  while(ch>='0' && ch<='9') x=x*10+ch-'0',ch=getchar();
  return q?(-x):x;
}
struct date{
  int s,id;
  bool operator < (const date &c) const {
    return s<c.s;
  }
}d[N];
int tot,R,C,st[N],top;
int num(int x,int y){
  if (y==0) return x;
  if (x==R) return R+y;
  if (y==C) return R+C+R-x;
  return 2*R+2*C-y;
}
int main(){
  R=gi(),C=gi(); int n=gi(),a,b,c,f;
  for (int i=1; i<=n; ++i){
    a=gi(),b=gi(),c=gi(),f=gi();
    if ((a==0||b==0||a==R||b==C)&&(c==0||f==0||c==R||f==C)){
      d[++tot]=(date){num(a,b),i};
      d[++tot]=(date){num(c,f),i};
    }
  }
  sort(d+1,d+tot+1);
  for (int i=1; i<=tot; ++i){
    if (st[top]==d[i].id) --top;
    else st[++top]=d[i].id;
  }
  puts(top?"NO":"YES");
  return 0;
}
