import sys, math, collections, heapq, itertools
F = sys.stdin
def single_input(): return F.readline().strip("\n")
def line_input(): return F.readline().strip("\n").split()
def solve():
R, C, N = map(int, line_input())
u, l, r, d = [], [], [], []
for i in range(N):
x, y, z, w = map(int, line_input())
if x == 0:
if z == 0:
u.append((x, y, i))
u.append((z, w, i))
elif w == C:
u.append((x, y, i))
r.append((z, w, i))
elif z == R:
u.append((x, y, i))
d.append((z, w, i))
elif w == 0:
u.append((x, y, i))
l.append((x, y, i))
elif x == R:
if z == 0:
d.append((x, y, i))
u.append((z, w, i))
elif w == C:
d.append((x, y, i))
r.append((z, w, i))
elif z == R:
d.append((x, y, i))
d.append((z, w, i))
elif w == 0:
d.append((x, y, i))
l.append((x, y, i))
elif y == 0:
if z == 0:
l.append((x, y, i))
u.append((z, w, i))
elif w == C:
l.append((x, y, i))
r.append((z, w, i))
elif z == R:
l.append((x, y, i))
d.append((z, w, i))
elif w == 0:
l.append((x, y, i))
l.append((x, y, i))
elif y == C:
if z == 0:
r.append((x, y, i))
u.append((z, w, i))
elif w == C:
r.append((x, y, i))
r.append((z, w, i))
elif z == R:
r.append((x, y, i))
d.append((z, w, i))
elif w == 0:
r.append((x, y, i))
l.append((x, y, i))
u.sort()
r.sort()
d.sort(reverse = True)
l.sort(reverse = True)
s = []
used = set()
crossed = True
for point in u:
if point[2] not in used:
s.append(point[2])
used |= {point[2]}
else:
if s[-1] != point[2]: break
else: s.pop()
else:
for point in r:
if point[2] not in used:
s.append(point[2])
used |= {point[2]}
else:
if s[-1] != point[2]: break
else: s.pop()
else:
for point in d:
if point[2] not in used:
s.append(point[2])
used |= {point[2]}
else:
if s[-1] != point[2]: break
else: s.pop()
else:
for point in l:
if point[2] not in used:
s.append(point[2])
used |= {point[2]}
else:
if s[-1] != point[2]: break
else: s.pop()
else: crossed = False
print("NO" if crossed else "YES")
return 0
if __name__ == "__main__":
solve()