#include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>
const int N=1e5+5;
typedef std::pair<int,int> P;
std::vector<P> g;
P stk[N];int top,r,c,n;
int change(int x,int y) {
    if(y==0) return x;
    else if(x==r) return y+x;
    else if(y==c) return r+c+r-x;
    else return 2*(r+c)-y;
}
bool check(int x,int y) {
    return x==0||x==r||y==0||y==c;
}
int main() {
    scanf("%d%d%d",&r,&c,&n);
    int x1,y1,x2,y2,l,r;
    while(n--) {
        scanf("%d%d%d%d",&x1,&y1,&x2,&y2);
        if(!check(x1,y1)||!check(x2,y2)) continue;
        l=change(x1,y1),r=change(x2,y2);
        if(l>r) std::swap(l,r);
        g.push_back(P(l,r));
    }
    std::sort(g.begin(),g.end());
    top=0;bool f=true;
    for(P &v:g) {
        while(top&&v.second>stk[top-1].second) {
            if(v.first<stk[top-1].second) {
                f=false;break;
            }
            --top;
        }
        stk[top++]=v;
        if(!f) break;
    }
    printf("%s\n",f?"YES":"NO");
    return 0;
}
