Snuke is playing a puzzle game. In this game, you are given a rectangular board of dimensions R × C, filled with numbers. Each integer i from 1 through N is written twice, at the coordinates (x_{i,1},y_{i,1}) and (x_{i,2},y_{i,2}).

The objective is to draw a curve connecting the pair of points where the same integer is written, for every integer from 1 through N. Here, the curves may not go outside the board or cross each other.

Determine whether this is possible.

Constraints

* 1 ≤ R,C ≤ 10^8
* 1 ≤ N ≤ 10^5
* 0 ≤ x_{i,1},x_{i,2} ≤ R(1 ≤ i ≤ N)
* 0 ≤ y_{i,1},y_{i,2} ≤ C(1 ≤ i ≤ N)
* All given points are distinct.
* All input values are integers.

Input

Input is given from Standard Input in the following format:


R C N
x_{1,1} y_{1,1} x_{1,2} y_{1,2}
:
x_{N,1} y_{N,1} x_{N,2} y_{N,2}


Output

Print `YES` if the objective is achievable; print `NO` otherwise.

Examples

Input

4 2 3
0 1 3 1
1 1 4 1
2 0 2 2


Output

YES


Input

2 2 4
0 0 2 2
2 0 0 1
0 2 1 2
1 1 2 1


Output

NO


Input

5 5 7
0 0 2 4
2 3 4 5
3 5 5 2
5 5 5 4
0 3 5 1
2 2 4 4
0 5 4 1


Output

YES


Input

1 1 2
0 0 1 1
1 0 0 1


Output

NO
def examC():
    ans = 0
    print(ans)
    return

def examD():
    ans = 0
    print(ans)
    return

def examE():
    R, C, N = LI()
    P = []
    P1 = []; P2 = []; P3 = []; P4 = []
    index = 0
    for i in range(N):
        x1,y1,x2,y2 = LI()
        if (x1 not in (0,R)) and (y1 not in (0,C)):
            continue
        if (x2 not in (0,R)) and (y2 not in (0,C)):
            continue

        if x1==0:
            P1.append((x1, y1, index))
        elif y1 == C:
            P2.append((x1, y1, index))
        elif x1==R:
            P3.append((x1, y1, index))
        else:
            P4.append((x1, y1, index))

        if x2==0:
            P1.append((x2, y2, index))
        elif y2 == C:
            P2.append((x2, y2, index))
        elif x2==R:
            P3.append((x2, y2, index))
        else:
            P4.append((x2, y2, index))
        index += 1
    P1.sort(key=lambda x:x[1])
    P2.sort()
    P3.sort(key=lambda x:x[1], reverse=True)
    P4.sort(reverse=True)
    for _,_,p in P1:
        P.append(p)
    for _,_,p in P2:
        P.append(p)
    for _,_,p in P3:
        P.append(p)
    for _,_,p in P4:
        P.append(p)
    #print(P)

    que = deque()
    for index in P:
        if que:
            now = que.pop()
            if index==now:
                continue
            que.append(now)
            que.append(index)
        else:
            que.append(index)
    if que:
        print("NO")
    else:
        print("YES")
    return

def examF():
    ans = 0
    print(ans)
    return

from decimal import getcontext,Decimal as dec
import sys,bisect,itertools,heapq,math,random
from copy import deepcopy
from heapq import heappop,heappush,heapify
from collections import Counter,defaultdict,deque
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
def I(): return int(input())
def LI(): return list(map(int,sys.stdin.readline().split()))
def DI(): return dec(input())
def LDI(): return list(map(dec,sys.stdin.readline().split()))
def LSI(): return list(map(str,sys.stdin.readline().split()))
def LS(): return sys.stdin.readline().split()
def SI(): return sys.stdin.readline().strip()
global mod,mod2,inf,alphabet,_ep
mod = 10**9 + 7
mod2 = 998244353
inf = 10**18
_ep = dec("0.000000000001")
alphabet = [chr(ord('a') + i) for i in range(26)]
alphabet_convert = {chr(ord('a') + i): i for i in range(26)}

getcontext().prec = 28

sys.setrecursionlimit(10**7)

if __name__ == '__main__':
    examE()

"""
142
12 9 1445 0 1
asd dfg hj o o
aidn
"""