#include <bits/stdc++.h>

std::vector<std::pair<int, int>> v;
std::stack<int> s;

int r, c, n;

bool on_border(int x, int y) {return !x || x == r || !y || y == c;}
int pos(int x, int y) {
	if (!x) return y;
	if (y == c) return x + 2e8;
	if (x == r) return c - y + 4e8;
	return r - x + 6e8;
}

int main() {
	std::ios::sync_with_stdio(0), std::cin.tie(0);
	std::cin >> r >> c >> n;
	for (int i = 0; i < n; ++i) {
		int x, y, X, Y; std::cin >> x >> y >> X >> Y;
		if (on_border(x, y) && on_border(X, Y))
			v.emplace_back(pos(x, y), i), v.emplace_back(pos(X, Y), i);
	}
	std::sort(v.begin(), v.end());
	for (auto p : v)
		if (s.size() && s.top() == p.second) s.pop();
		else s.push(p.second);
	std::cout << (s.size() ? "NO" : "YES") << '\n';
	return 0;
}