#include <bits/stdc++.h>
using namespace std;
#ifdef ENABLE_DEBUG
#define dump(a) cerr<<#a<<"="<<a<<endl
#define dumparr(a,n) cerr<<#a<<"["<<n<<"]="<<a[n]<<endl
#else
#define dump(a) 
#define dumparr(a,n) 
#endif
#define FOR(i, a, b) for(int i = a;i < b;i++)
#define For(i, a) FOR(i, 0, a)
#define REV(i, a, b) for(int i = b-1;i >= a;i--)
#define Rev(i, a) REV(i, 0, a)
#define REP(a) For(i, a)

typedef long long int ll;
typedef unsigned long long ull;
typedef unsigned int uint;
typedef pair<ll, ll> pll;
typedef pair<ll,pll> ppll;
typedef vector<ll> vll;

const ll INF=(1LL<<50);

template<class S,class T>
std::ostream& operator<<(std::ostream& os,pair<S,T> a){
  os << "(" << a.first << "," << a.second << ")";
  return os;
}
template<class T>
std::ostream& operator<<(std::ostream& os,vector<T> a){
  os << "[ ";
  REP(a.size()){
    os<< a[i] << " ";
  }
  os<< " ]";
  return os;
}

const string YES = "YES";
const string NO = "NO";
ll R,C;
pll operator-(pll a,pll b){
  pll ret;
  ret.first=a.first-b.first;
  ret.second=a.second-b.second;
  return ret;
}
ll operator*(pll a,pll b){
  return a.first*b.second-a.second*b.first;
}
ll scala(pll a){
  return a.first*a.first+a.second*a.second;
}
bool in_vec(pll a,pll b,pll c){
  return scala(a-b)>scala(a-c)&&scala(b-a)>scala(b-c);
}
bool is_kousa(pll a,pll b,pll c, pll d){
  if((a-b)*(c-d)==0){
    if((a-b)*(a-c)==0){
      if(in_vec(a,b,c)||in_vec(a,b,d)){
        return true;
      }
      return false;
    }
    return false;
  }
  ll w,x,y,z;
  w=(c.first-d.first)*(a.second-c.second)+(c.second-d.second)*(c.first-a.first);
  x=(c.first-d.first)*(b.second-c.second)+(c.second-d.second)*(c.first-b.first);
  y=(a.first-b.first)*(c.second-a.second)+(a.second-b.second)*(a.first-c.first);
  z=(a.first-b.first)*(d.second-a.second)+(a.second-b.second)*(a.first-d.first);
  dump(w);
  dump(x);
  dump(y);
  dump(z);
  return y*z<0&&w*x<0;
}
bool is_fuchi(pll a){
  dump(a);
  if(a.first==0||a.first==R||a.second==0||a.second==C){
    dump("is true");
    return true;
  }
    dump("is false");
  return false;
}
ll dist(pll a){
  if(a.second==0){
    return a.first;
  }
  if(a.first==R){
    return R+a.second;
  }
  if(a.second==C){
    return R+C+R-a.first;
  }
  return R+R+C+C-a.second;
}
void solve(long long R, long long C, long long N, std::vector<pll> x, std::vector<pll> y){
  vector<pair<pll,ll>> p;
  REP(N){
    if(is_fuchi(x[i])&&is_fuchi(y[i])){
      p.push_back({x[i],i});
      p.push_back({y[i],i});
    }
  }
  sort(p.begin(),p.end(),[](pair<pll,ll> a,pair<pll,ll> b){
    return dist(a.first)<dist(b.first);
  });
  vector<pair<pll,ll>> pp;
  for (auto &&i : p)
  {
    if(pp.empty()||pp.back().second!=i.second){
      pp.push_back(i);
    }else{
      pp.pop_back();
    }
  }
  if(pp.empty())
    cout<<YES<<endl;
  else 
    cout<<NO<<endl;
  return ;

}

int main(){
    scanf("%lld",&R);
    scanf("%lld",&C);
    long long N;
    scanf("%lld",&N);
    std::vector<pll> x(N);
    std::vector<pll> y(N);
    for(int i = 0 ; i < N ; i++){
            scanf("%lld",&x[i].first);
            scanf("%lld",&x[i].second);
            scanf("%lld",&y[i].first);
            scanf("%lld",&y[i].second);
    }
    solve(R, C, N, std::move(x), std::move(y));
    return 0;
}


Measured memory_bytes: 14700