#include <iostream>
#include <vector>
#include <stack>
#include <utility>
#include <algorithm>
using namespace std;

typedef pair<int, int> pi;

int H, W, N;
vector<pi> D;
stack<int> S;

void add_vec(int x, int y, int id) {
	int d;
	if (y == 0)
		d = x;
	else if (x == W)
		d = W + y;
	else if (y == H)
		d = W + H + (W - x);
	else
		d = W + H + W + (H - y);
	D.push_back(make_pair(d, id));
}

int main(void) {
	cin >> H >> W >> N;
	for (int i = 0; i < N; ++i) {
		int y1, x1, y2, x2;
		cin >> y1 >> x1 >> y2 >> x2;
		if (((y1 == 0 || y1 == H) || (x1 == 0 || x1 == W))
				&& ((y2 == 0 || y2 == H) || (x2 == 0 || x2 == W))) {
			add_vec(x1, y1, i);
			add_vec(x2, y2, i);
		}
	}
	sort(D.begin(), D.end());
	for (int i = 0; i < (int)D.size(); ++i) {
		if (S.empty())
			S.push(D[i].second);
		else {
			if (S.top() == D[i].second)
				S.pop();
			else
				S.push(D[i].second);
		}
	}
	if (S.empty())
		cout << "YES\n";
	else
		cout << "NO\n";
	return 0;
}
