#include <bits/stdc++.h>
#define REP(i,a,b) for(int i=(a);i<(b);i++)
#define RREP(i,a,b) for(int i=(a);i>=(b);i--)
#define pq priority_queue
#define P pair<ll,int>
#define P2 pair<int,P>
#define P3 pair<int,P2>
typedef long long ll; typedef long double ld;
using namespace std;
const int INF=1e9, MOD=1e9+7, around[]={0,1,1,-1,-1,0,-1,1,0,0};
const ll LINF=1e18;
const ld PI=abs(acos(-1));
 
ll h,w,n;
vector<P> vec;
 
bool ch(int x, int y){
	if(x == h) return true;
	if(x == 0) return true;
	if(y == w) return true;
	if(y == 0) return true;
	return false;
} 
 
ll f(int x, int y){
	if(x == 0){
		return (ll)y;
	}else if(x == h){
		return (ll)INF + (ll)INF + (ll)w - (ll)y;
	}else if(y == 0){
		return (ll)INF + (ll)INF + (ll)INF + (ll)h - (ll)x;
	}else if(y == w){
		return (ll)INF + (ll)x;
	}
}
 
int main(){
	cin >> h >> w >> n;
	int c = 0;
	REP(i,0,n){
		int x,y,xx,yy; cin >> x >> y >> xx >> yy;
		if(ch(x, y) and ch(xx, yy)){
			vec.push_back({f(x, y), c});
			vec.push_back({f(xx, yy), c++});
		}
	}
	sort(vec.begin(), vec.end());
	
	stack<int> st;
	REP(i,0,vec.size()){
		if(!st.empty() and st.top() == vec[i].second) st.pop();
		else st.push(vec[i].second);
	}
	
	if(st.empty()) cout << "YES" << endl;
	else cout << "NO" << endl;
	return 0;
}