#include <bits/stdc++.h>
using namespace std;
typedef pair<double,double> pdd;
double PI=3.14159265359;
vector<pair<double,int> > angles;
int r,c,n;

bool isBoundary(int x1, int y1, int x2, int y2){
	bool ok1=false,ok2=false;
	if(x1==0 || x1==r || y1==0 || y1==c)
		ok1=true;
	if(x2==0 || x2==r || y2==0 || y2==c)
		ok2=true;

	return ok1 && ok2;
}

int main(){
	int x1,y1,x2,y2;
	cin >> r >> c >> n;
	pdd center=make_pair(r/2.0,c/2.0);
	pdd arr[n];
	double x,y;
	for(int i=0;i<n;i++){
		cin >> x1 >> y1 >> x2 >> y2;
		if(isBoundary(x1,y1,x2,y2)){
			angles.push_back(make_pair((180/PI)*atan2(y1-center.second,x1-center.first),i));
			angles.push_back(make_pair((180/PI)*atan2(y2-center.second,x2-center.first),i));
		}
	}
	sort(angles.begin(),angles.end());
	stack<int> s;
	int len=angles.size();
	for(int i=0;i<len;i++){
		if(s.empty()){
			s.push(angles[i].second);
		}
		else if(s.top()==angles[i].second)
			s.pop();
		else
			s.push(angles[i].second);
	}
	cout << (s.empty()?"YES\n":"NO\n");

	return 0;
}