#include <bits/stdc++.h>
#define f first
#define s second
using namespace std;
typedef long long ll;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;

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

int main() {
	int N;
	cin >> R >> C >> N;
	vii v;
	for (int i = 0; i < N; ++i) {
		int x1, y1, x2, y2;
		cin >> x1 >> y1 >> x2 >> y2;
		int a = f(x1, y1), b = f(x2, y2);
		if (a > b) swap(a, b);
		if (a != -1 && b != -1) {
			v.emplace_back(a, i);
			v.emplace_back(b, i);
		}
	}
	sort(v.begin(), v.end());
	bool ans = 1;
	stack<int> S;
	bitset<100001> vis;
	for (int i = 0; i < v.size(); ++i) {
		if (!vis[v[i].s]) {
			S.emplace(v[i].s);
			vis[v[i].s] = 1;
		}
		else {
			while (!S.empty() && S.top() != v[i].s) S.pop();
			if (S.empty()) {
				cout << "NO" << '\n';
				return 0;
			}
			S.pop();
		}
	}
	cout << "YES" << '\n';
	return 0;
}