import std.stdio;
import std.conv, std.array, std.algorithm, std.string;
import std.math, std.random, std.range, std.datetime;
import std.bigint;
import std.container;
string read(){ static string[] ss; while(!ss.length) ss = readln.chomp.split; string res = ss[0]; ss.popFront; return res; }

long r, c, n;
void main(){
	r = read.to!long;
	c = read.to!long;
	n = read.to!long;
	
	// debug writeln([pos(0, 0), pos(0, 1), pos(0, c - 1), pos(0, c), pos(1, c), pos(r - 1, c), pos(r, c), pos(r, c - 1), pos(r, 1), pos(r, 0), pos(r - 1, 0), pos(1, 0)]);
	
	long[long] uset;
	foreach(i; 0 .. n){
		long x1 = read.to!long;
		long y1 = read.to!long;
		long x2 = read.to!long;
		long y2 = read.to!long;
		
		if(!isOnEdge(x1, y1) || !isOnEdge(x2, y2)) continue;
		
		uset[pos(x1, y1)] = i;
		uset[pos(x2, y2)] = i;
		}
	debug uset.writeln;
	
	long[] ks = uset.keys.dup;
	ks.sort();
	
	long[] us = ks.map!(k => uset[k]).array;
	debug us.writeln;
	
	long[] sta = [];
	foreach(u; us){
		if(!sta.length || sta[$ - 1] != u) sta ~= u;
		else sta.length -= 1;
		}
	
	string ans = sta.length? "NO": "YES";
	
	ans.writeln;
	
	}

long pos(long x, long y){
	if(x == 0) return y;
	if(y == c) return c + x;
	if(x == r) return c + r + c - y;
	if(y == 0) return c + r + c + r - x;
	return 0;
	}

bool isOnEdge(long x, long y){
	return x == 0 || y == c || x == r || y == 0;
	}