#include<bits/stdc++.h>

using namespace std;

using ll=long long;

ll r,c;

bool is_wall(ll x,ll y){
	if(x==0 || x==r)return 1;
	if(y==0 || y==c)return 1;
	return 0;
}

int main(){
	ll n;
	cin>>r>>c>>n;
	ll j=0;
	vector<pair<ll,ll>>v;
	for(ll i=0;i<n;++i){
		ll x1,y1,x2,y2;
		cin>>x1>>y1>>x2>>y2;
		if(is_wall(x1,y1) && is_wall(x2,y2)){
			if(y1==0)v.push_back(make_pair(x1,j));
			else if(y1==c)v.push_back(make_pair(2*r+c-x1,j));
			else if(x1==0)v.push_back(make_pair(2*r+2*c-y1,j));
			else if(x1==r)v.push_back(make_pair(r+y1,j));
			if(y2==0)v.push_back(make_pair(x2,j));
			else if(y2==c)v.push_back(make_pair(2*r+c-x2,j));
			else if(x2==0)v.push_back(make_pair(2*r+2*c-y2,j));
			else if(x2==r)v.push_back(make_pair(r+y2,j));
			j++;
		}
	}
	sort(v.begin(),v.end());
	int m[100001]={};
	int k=0;
	for(auto x:v){
		if(!m[x.second]){
			m[x.second]=++k;
		}else{
			if(m[x.second]!=k){
				cout<<"NO"<<endl;
				return 0;
			}else{
				k--;
			}
		}
	}
	cout<<"YES"<<endl;
	return 0;
}
