import std.algorithm;
import std.range;
import std.stdio;
import std.typecons;

bool solve (int r, int c, int n)
{
	auto x1 = new int [n];
	auto y1 = new int [n];
	auto x2 = new int [n];
	auto y2 = new int [n];

	bool isBorder (int x, int y)
	{
		return x == 0 || x == r || y == 0 || y == c;
	}

	alias Point = Tuple !(int, q{coord}, int, q{kind});

	auto coord (int x, int y)
	{
		int res = 0;
		if (x == 0)
		{
			debug {writeln ("x == 0");}
			return res + y;
		}
		res += c;
		if (y == c)
		{
			debug {writeln ("y == c");}
			return res + x;
		}
		res += r;
		if (x == r)
		{
			debug {writeln ("x == r");}
			return res + (c - y);
		}
		res += c;
		if (y == 0)
		{
			debug {writeln ("y == 0");}
			return res + (r - x);
		}
		assert (false);
	}

	Point [] points;
	foreach (i; 0..n)
	{
		readf (" %s %s %s %s", &x1[i], &y1[i], &x2[i], &y2[i]);
		if (isBorder (x1[i], y1[i]) && isBorder (x2[i], y2[i]))
		{
			points ~= Point (coord (x1[i], y1[i]), i);
			points ~= Point (coord (x2[i], y2[i]), i);
		}
	}
	debug {writeln (points.map !(point => point.coord));}
	sort (points);

	int [] kinds;
	foreach (ref point; points)
	{
		if (!kinds.empty && kinds[$ - 1] == point.kind)
		{
			kinds.length--;
		}
		else
		{
			kinds.assumeSafeAppend ();
			kinds ~= point.kind;
		}
	}
	return kinds.empty;
}

void main ()
{
	int r, c, n;
	while (readf (" %s %s %s", &r, &c, &n) > 0)
	{
		writeln (solve (r, c, n) ? "YES" : "NO");
	}
}
