#include<iostream>
#include<cstdio>
#include<map>
#include<stack>
using namespace std;
typedef long long LL;
LL R,C;
 
LL dist(LL x,LL y){
    if(x!=0&&x!=R&&y!=0&&y!=C) return -1;
    if(y==0) return x;
    if(x==R) return R+y;
    if(y==C) return 2*R+C-x;
    if(x==0) return 2*(R+C)-y;
    return -1;
}
 
int main(){
    map<LL,int> mp;
    stack<int> s;
    int N;
    cin >> R >> C >> N;
    for(int i=0;i<N;i++){
        LL x1,y1,x2,y2;
        cin >> x1 >> y1 >> x2 >> y2;
        if(dist(x1,y1)!=-1&&dist(x2,y2)!=-1){
            mp[dist(x1,y1)]=i;
            mp[dist(x2,y2)]=i;
        }
    }
    s.push(-1);
    for(auto p : mp){
        if(p.second!=s.top()) s.push(p.second);
        else s.pop();
    }
    if(s.size()==1) puts("YES");
    else puts("NO");
    return 0;
}