#include <bits/stdc++.h>
using namespace std;
#define modulo 998244353
#define mod(mod_x) ((((long long)mod_x+modulo))%modulo)
#define Inf 100000000

int R,C;

int get(int x,int y){
	if(x==0)return y;
	if(y==C)return C+x;
	if(x==R)return R+C+(C-y);
	return C+R+C+(R-x);
}

int main(){
	
	int N;
	cin>>R>>C>>N;
	
	vector<pair<int,int>> P;
	
	for(int i=0;i<N;i++){
		int x1,x2,y1,y2;
		cin>>x1>>y1>>x2>>y2;
		
		if(x1!=0&&x1!=R&&y1!=0&&y1!=C)continue;
		if(x2!=0&&x2!=R&&y2!=0&&y2!=C)continue;
		
		P.emplace_back(get(x1,y1),i);
		P.emplace_back(get(x2,y2),i);
	}
	
	sort(P.begin(),P.end());
	vector<int> A(0);
	for(int i=0;i<P.size();i++){
		if(A.size()==0||A.back()!=P[i].second){
			A.push_back(P[i].second);
		}
		else{
			A.pop_back();
		}
	}
	
	if(A.size()==0)cout<<"YES"<<endl;
	else cout<<"NO"<<endl;
	
    return 0;
}

