#include <iostream>
#include <utility>
#include <vector>
#include <algorithm>
#include <stack>
using namespace std;

int R, C;

int clockwise_dist(int x, int y){
	if(x==0) return y;
	if(y==C) return C+x;
	if(x==R) return C*2+R-y;
	if(y==0) return (C+R)*2-x;
	return -1;
}

int main() {
	int N;
	cin >> R >> C >> N;
	vector<pair<int, int>> v;
	for(int i=0; i<N; ++i){
		int x1, y1, x2, y2;
		cin >> x1 >> y1 >> x2 >> y2;
		int s=clockwise_dist(x1, y1), t=clockwise_dist(x2, y2);
		if(s>=0 && t>=0){
			v.emplace_back(make_pair(s, i));
			v.emplace_back(make_pair(t, i));
		}
	}
	sort(v.begin(), v.end());
	stack<int> stk;
	for(int i=0; i<v.size(); ++i){
		if(stk.size()==0) stk.emplace(v[i].second);
		else if(stk.top()==v[i].second) stk.pop();
		else stk.emplace(v[i].second);
	}
	cout << (stk.size()==0 ? "YES": "NO") << endl;
	return 0;
}