// I need some holiday
// But I don't wish that everyday is holiday
// Because I didn't bear the pain
// Because it wasn't a true freedom
//         ——『イヤホンと蝉時雨』·Orangestar

#include <bits/stdc++.h>

using namespace std;

typedef long long LL;
typedef unsigned int UI;
typedef pair<int, int> pii;

#define DEBUG(...) fprintf(stderr, __VA_ARGS__)
#define MP make_pair
#define fst first
#define snd second
#define SZ(u) ((int) (u).size())
#define ALL(u) (u).begin(), (u).end()

inline void proc_status()
{
	ifstream t("/proc/self/status");
	cerr << string(istreambuf_iterator<char>(t), istreambuf_iterator<char>()) << endl;
}

template<typename T> inline int chkmin(T &a, const T &b) { return b < a ? a = b, 1 : 0; }
template<typename T> inline int chkmax(T &a, const T &b) { return b > a ? a = b, 1 : 0; }
template<typename T> inline T sqr(const T &val) { return val * val; }

namespace fastIO
{
	const int MAX_BUFFER_SIZE = 1 << 16;

	char buffer[MAX_BUFFER_SIZE], *cur = buffer, *ed = buffer;

	inline char getc() { return cur == ed && (ed = (cur = buffer) + fread(buffer, 1, MAX_BUFFER_SIZE, stdin), cur == ed) ? EOF : *cur++; }
}
using fastIO::getc;

template<typename T> inline T read()
{
	register T sum(0), fg(1);
	register char ch(getc());
	for(; !isdigit(ch); ch = getc()) if(ch == '-') fg = -1;
	for(;  isdigit(ch); ch = getc()) sum = sum * 10 - '0' + ch;
	return sum * fg;
}

inline char *read_str(char *s)
{
	register char ch(getc());
	while(!isgraph(ch)) ch = getc();
	for(; isgraph(ch); ch = getc()) *s++ = ch;
	*s = '\0';
	return s;
}

// END tpl.

const int MAXN = (int) 1e5;

struct seg
{
	int l, r;

	seg() { }
	seg(int _l, int _r): l(_l), r(_r) { }
};

vector<seg> a;

inline void input()
{
	int R = read<int>(), C = read<int>(), n = read<int>();

	auto get_id = [&] (int x, int y)
	{
		if(x != 0 && x != R && y != 0 && y != C) return -1;
		int st = 1;
		if(x == 0) return st + y - 0;
		st += C;
		if(y == C) return st + x - 0;
		st += R;
		if(x == R) return st + C - y;
		st += C;
		if(y == 0) return st + R - x;
		assert(0);
	};

	while(n--)
	{
		int x0 = read<int>(), y0 = read<int>(), x1 = read<int>(), y1 = read<int>();
		int l = get_id(x0, y0), r = get_id(x1, y1);
		if(l == -1 || r == -1) continue;
		if(l > r) swap(l, r);
		a.emplace_back(l, r);
	}
}

inline void discrete()
{
	static vector<int> vals;

	for(auto i : a)
	{
		vals.push_back(i.l);
		vals.push_back(i.r);
	}
	sort(ALL(vals)), vals.erase(unique(ALL(vals)), vals.end());

	for(auto &i : a)
	{
		i.l = lower_bound(ALL(vals), i.l) - vals.begin() + 1;
		i.r = lower_bound(ALL(vals), i.r) - vals.begin() + 1;
	}
}

namespace BIT
{
	int N, c[MAXN * 2 + 5];

	inline void init(int _N) { N = _N, memset(c, 0, sizeof c); }
	inline void add(int p, int val) { for(; p <= N; p += p & -p) c[p] += val; }
	inline int prefix(int p) { int res = 0; for(; p; p -= p & -p) res += c[p]; return res; }
}

inline void solve()
{
	discrete();

	static int ins[MAXN * 2 + 5];
	static vector<int> del[MAXN * 2 + 5];

	int N = 0;
	for(auto i : a)
	{
		chkmax(N, i.r);
		++ins[i.l];
		del[i.r].push_back(i.l);
	}

	BIT::init(N);
	for(int r = 1; r <= N; ++r)
	{
		if(ins[r]) BIT::add(r, ins[r]);
		for(auto l : del[r])
		{
			if(l + 1 <= r - 1 && BIT::prefix(r - 1) - BIT::prefix(l) > 0) { puts("NO"); return; }
			BIT::add(l, -1);
		}
	}
	puts("YES");
}

int main()
{
#ifdef K_ON
	freopen("E.in", "r", stdin);
	freopen("E.out", "w", stdout);
#endif

	input();
	solve();

	return 0;
}




Measured memory_bytes: 11252