    n,m,q = input().split(" ")
    n1=int(n/2)
    m1=(m/2)
    for i in range(int(q)):
        a,b,c,d = input().split(" ")
        a = int(a)
        b= int(b)
        c = int(c)
        d=int(d)
        if(a==1 and c==2):
            if((b<=n1 and d<=m1) or (b>n1 and d>m1)):
                print("YES")
            else:
                print("NO")
       if(a==2 and c==1):
            if((b<=m1 and d<=n1) or (b>m1 and d>n1)):
                print("YES")
            else:
                print("NO")
     if(a==1 and c==1):
            if((b<=n1 and d<=n1) or (b>n1 and d>n1)):
                print("YES")
            else:
                print("NO")
     if(a==2 and c==2):
            if((b<=m1 and d<=m1) or (b>m1 and d>m1)):
                print("YES")
            else:
                print("NO")
      