#include<iostream>
#include<stack>
#include<algorithm>
using namespace std;
const int MAX = 100000;
int main() {
	int R, C, N, x1, y1, x2, y2, upc = 0, downc = 0, leftc = 0, rightc = 0;
	static pair<int, int> up[MAX], down[MAX], left[MAX], right[MAX];
	stack<int> sta;
	cin >> R >> C >> N;
	for (int i = 0;i < N;i ++) {
		cin >> x1 >> y1 >> x2 >> y2;
		if (x1 == 0) {
			if (x2 == 0) {
				left[leftc] = make_pair(C - y1, i);
				leftc ++;
				left[leftc] = make_pair(C - y2, i);
				leftc ++;
			} else if (x2 == R) {
				left[leftc] = make_pair(C - y1, i);
				leftc ++;
				right[rightc] = make_pair(y2, i);
				rightc ++;
			} else if (y2 == 0) {
				left[leftc] = make_pair(C - y1, i);
				leftc ++;
				up[upc] = make_pair(x2, i);
				upc ++;
			} else if (y2 == C) {
				left[leftc] = make_pair(C - y1, i);
				leftc ++;
				down[downc] = make_pair(R - x2, i);
				downc ++;
			}
		} else if (x1 == R) {
			if (x2 == 0) {
				right[rightc] = make_pair(y1, i);
				rightc ++;
				left[leftc] = make_pair(C - y2, i);
				leftc ++;
			} else if (x2 == R) {
				right[rightc] = make_pair(y1, i);
				rightc ++;
				right[rightc] = make_pair(y2, i);
				rightc ++;
			} else if (y2 == 0) {
				right[rightc] = make_pair(y1, i);
				rightc ++;
				up[upc] = make_pair(x2, i);
				upc ++;
			} else if (y2 == C) {
				right[rightc] = make_pair(y1, i);
				rightc ++;
				down[downc] = make_pair(R - x2, i);
				downc ++;
			}
		} else if (y1 == 0) {
			if (x2 == 0) {
				up[upc] = make_pair(x1, i);
				upc ++;
				left[leftc] = make_pair(C - y2, i);
				leftc ++;
			} else if (x2 == R) {
				up[upc] = make_pair(x1, i);
				upc ++;
				right[rightc] = make_pair(y2, i);
				rightc ++;
			} else if (y2 == 0) {
				up[upc] = make_pair(x1, i);
				upc ++;
				up[upc] = make_pair(x2, i);
				upc ++;
			} else if (y2 == C) {
				up[upc] = make_pair(x1, i);
				upc ++;
				down[downc] = make_pair(R - x2, i);
				downc ++;
			}
		} else if (y1 == C) {
			if (x2 == 0) {
				down[downc] = make_pair(R - x1, i);
				downc ++;
				left[leftc] = make_pair(C - y2, i);
				leftc ++;
			} else if (x2 == R) {
				down[downc] = make_pair(R - x1, i);
				downc ++;
				right[rightc] = make_pair(y2, i);
				rightc ++;
			} else if (y2 == 0) {
				down[downc] = make_pair(R - x1, i);
				downc ++;
				up[upc] = make_pair(x2, i);
				upc ++;
			} else if (y2 == C) {
				down[downc] = make_pair(R - x1, i);
				downc ++;
				down[downc] = make_pair(R - x2, i);
				downc ++;
			}
		}
	}
	sort(up, up + upc);
	sort(down, down + downc);
	sort(left, left + leftc);
	sort(right, right + rightc);
	for (int i = 0;i < upc;i ++) {
//		cout << up[i].second + 1 << endl;
		if (!sta.empty() && sta.top() == up[i].second) sta.pop();
		else sta.push(up[i].second);
	}
	for (int i = 0;i < rightc;i ++) {
//		cout << right[i].second + 1 << endl;
		if (!sta.empty() && sta.top() == right[i].second) sta.pop();
		else sta.push(right[i].second);
	}
	for (int i = 0;i < downc;i ++) {
//		cout << down[i].second + 1 << endl;
		if (!sta.empty() && sta.top() == down[i].second) sta.pop();
		else sta.push(down[i].second);
	}
	for (int i = 0;i < leftc;i ++) {
//		cout << left[i].second + 1 << endl;
		if (!sta.empty() && sta.top() == left[i].second) sta.pop();
		else sta.push(left[i].second);
	}
	
	if (sta.empty()) cout << "YES";
	else cout << "NO";
	return 0;
}

Measured memory_bytes: 2176