#include<cstdio>
#include<cstring>
#include<algorithm>
#include<vector>
using namespace std;
const int N=100005;
int r,c,n,xl[N],yl[N],xr[N],yr[N],stk[N];
struct data{
	int x,id,ck;
	data(){}
	data(int x,int id,int ck):x(x),id(id),ck(ck){}
	bool operator < (const data &n) const{
		return x<n.x;
	}
};
vector<data> vec;
int gao(int x,int y){
	if(x==0){
		return y;
	}
	if(y==c){
		return x+c;
	}
	if(x==r){
		return c+r+c-y;
	}
	if(y==0){
		return c+r+c+r-x;
	}
	return 0;
}
int main(){
	scanf("%d%d%d",&r,&c,&n);
	for(int i=1;i<=n;i++){
		scanf("%d%d%d%d",&xl[i],&yl[i],&xr[i],&yr[i]);
		if(xl[i]!=0&&xl[i]!=r&&yl[i]!=0&&yl[i]!=c){
			continue;
		}
		if(xr[i]!=0&&xr[i]!=r&&yr[i]!=0&&yr[i]!=c){
			continue;
		}
		int ll=gao(xl[i],yl[i]);
		int rr=gao(xr[i],yr[i]);
		if(ll>rr){
			swap(ll,rr);
		}
		vec.push_back(data(ll,i,0));
		vec.push_back(data(rr,i,1));
	}
	sort(vec.begin(),vec.end());
	for(int i=0;i<(int)vec.size();i++){
		if(!vec[i].ck){
			stk[++stk[0]]=vec[i].id;
		}else{
			if(stk[stk[0]]!=vec[i].id){
				puts("NO");
				return 0;
			}
			stk[0]--;
		}
	}
	puts("YES");
	return 0;
}