#include<stdio.h>
#include<stdlib.h>
#define int long long
int r,c,n,x1,y1,x2,y2,t1,t2,t3;
signed main(){
	scanf("%lld %lld %lld", &r,&c,&n);
	for(int i=1;i<=n;i++){
		scanf("%lld %lld %lld %lld", &x1,&y1,&x2,&y2);
		if(t3==1&&abs(x2-x1)==r&&abs(y1-y2)==c){
			printf("NO");
			return 0;
		}
		if(abs(x2-x1)==r&&abs(y1-y2)==c) t3=1;
		else if(abs(x2-x1)==r) t1=1;
		else if(abs(y1-y2)==c) t2=1;
	}
	if(t1+t2+t3>=2) printf("NO");
	else printf("YES");
}