#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,a) for(int i=0;i<(a);i++)
const ll MOD=1000000007;

// 原点から時計回りに 0*X:上辺, 1*X:右辺, 2*X:下辺, 3*X:左辺
const ll X=10101010101;

int main(){
  ll R,C; int N; cin>>R>>C>>N;
  vector<pair<ll,int> > V;
  rep(i,N){
    ll r[2],c[2]; cin>>r[0]>>c[0]>>r[1]>>c[1];
    bool flag[2]={};
    rep(j,2){
      if(r[j]==0||r[j]==R||c[j]==0||c[j]==C) flag[j]=1;
    }
    if(flag[0]&&flag[1]){
      rep(j,2){
        if(r[j]==0) V.push_back({c[j],i});
        else if(r[j]==R) V.push_back({-c[j]+2*X,i});
        else if(c[j]==0) V.push_back({-r[j]+3*X,i});
        else if(c[j]==C) V.push_back({r[j]+X,i});
      }
    }
  }
  sort(V.begin(),V.end());
  stack<int> st;
  rep(i,V.size()){
    if(st.empty()) st.push(V[i].second);
    else{
      if(st.top()==V[i].second) st.pop();
      else st.push(V[i].second);
    }
  }
  if(st.empty()) cout<<"YES"<<endl;
  else cout<<"NO"<<endl;
  return 0;
}
