#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100005;
using lint = long long;
using pi = pair<int, int>;
const int mod = 1e9 + 7;

int r, c, n;
vector<pi> seg;

int canon(int x, int y){
	if(1 <= x && x < r && 1 <= y && y < c) return -1;
	if(x == 0) return y;
	else if(y == c) return c + x;
	else if(x == r) return r + c + c - y;
	else return r + c + r + c - x;
}

int main(){
	scanf("%d %d %d",&r,&c,&n);
	for(int i=0; i<n; i++){
		int sx, sy, ex, ey;
		scanf("%d %d %d %d",&sx,&sy,&ex,&ey);
		int px = canon(sx, sy);
		int py = canon(ex, ey);
		if(px == -1 || py == -1) continue;
		if(px > py) swap(px, py);
		seg.emplace_back(px, py);
	}
	sort(seg.begin(), seg.end());
	vector<pi> stk;
	for(auto &i : seg){
		while(!stk.empty() && stk.back().second < i.first){
			stk.pop_back();
		}
		if(!stk.empty() && stk.back().second < i.second){
			puts("NO");
			return 0;
		}
		stk.push_back(i);
	}
	puts("YES");
}
