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

int r, c, n, x, y, z, t;
vector <pair <int, int> > arr;
stack<int> key;
bool check(int x, int y) {
	if(x != 0 && x != r && y != 0 && y != c) return false;
	return true;
}
int encode(int x, int y) {
	int ans = 0;
	if(x == 0) ans = y;
	else if(x == r) ans = r + 2*c - y;
	else if(y == 0) ans = 2*r + 2*c - x;
	else if(y == c) ans = c + x;
	return ans;
}
int main() {
	scanf("%d%d%d", &r, &c, &n);
	for(int i = 1; i <= n; i++) {
		scanf("%d%d%d%d", &x, &y, &z, &t);
		if(check(x, y) && check(z, t)) {
			int a = encode(x, y), b = encode(z, t);
			if(a > b) swap(a, b);
			arr.push_back({a, i});
			arr.push_back({b, -i});
		}
	}
	sort(arr.begin(), arr.end());
	for(int i = 0; i < arr.size(); i++) {
		if(arr[i].second > 0) key.push(arr[i].second);
		else {
			if(not key.empty() && arr[i].second + key.top() == 0) key.pop();
			else return !printf("NO");
		}
	}
	printf("YES");
}