#include <bits/stdc++.h>
using namespace std;

int R, C, N;
vector< pair<int, int> > V;

int get(int x, int y) {
	if (x == 0) {
		return y;
	} else if (y == C) {
		return x + C;
	} else if (x == R) {
		return C + R + (C - y);
	} else if (y == 0) {
		return C + R + C + (R - x);
	} else return -1;
}

stack<int> S;

int main() {
	scanf("%d%d%d", &R, &C, &N);
	for (int i = 0; i < N; i++) {
		int a, b, c, d;
		scanf("%d%d%d%d", &a, &b, &c, &d);
		int p1 = get(a, b);
		int p2 = get(c, d);
		if (p1 == -1 || p2 == -1) continue;
		V.push_back(make_pair(p1, i));
		V.push_back(make_pair(p2, i));
	}
	sort(V.begin(), V.end());
	for (int i = 0; i < V.size(); i++) {
		if (!S.empty() && S.top() == V[i].second) S.pop();
		else S.push(V[i].second);
	}
	if (!S.empty()) printf("NO\n");
	else printf("YES\n");
}
