#include <cstdio>
#include <cstdlib>
#include <cstring>

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>

#include <complex>

#include <functional>
#include <cassert>

typedef long long ll;
using namespace std;

#define debug(x) cerr << #x << " = " << (x) << endl;


#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 100010

int h,w,n,vh,vw;

int calc(int x, int y){
  if(y == 0){
    return x;
  }
  if(x == vw){
    return vw + y;
  }
  if(y == vh){
    return vw+vh+(vw-x);
  }
  if(x == 0){
    return vw+vh+vw+(vh-y);
  }

  assert(false);
}

/* RangeMinimumQuery(0-index) */

struct RMQ{
  typedef int Type;
  int segn2;
  Type inf;
  vector<Type> data;
  
  RMQ(int n){
    inf = INF; //init value
    for(segn2=1;segn2<n;segn2*=2);
    data.assign(segn2*2,inf);
  }
  
  //get minimum value [a,b]
  Type query(int a,int b,int l=0,int r=-1,int k=0){
    if(r==-1) r+=segn2;
    if(a<=l && r<=b) return data[k];
    if(r<a || b<l) return inf;
    return min(query(a,b,l,(l+r)/2,k*2+1),query(a,b,(l+r)/2+1,r,k*2+2));
  }
  
  //set kth number x
  void set(int k,Type x){
    k+=segn2-1;
    data[k]=x;
    while(k>0){
      k=(k-1)/2;
      data[k]=min(data[k*2+1],data[k*2+2]);
    }
    return;
  }
};

map<int,int> dicx, dicy;
vector<int> vecx,vecy;
vector<pair<int,pair<int,int> > > vec;

int main(){
  int x1[SIZE], y1[SIZE], x2[SIZE], y2[SIZE];
  
  scanf("%d%d%d",&h,&w,&n);
  
  for(int i=0;i<n;i++){
    scanf("%d%d%d%d",y1+i, x1+i, y2+i, x2+i);

    vecx.push_back(x1[i]);
    vecx.push_back(x2[i]);
    vecy.push_back(y1[i]);
    vecy.push_back(y2[i]);
  }
  
  vecx.push_back(0);
  vecx.push_back(w);
  vecy.push_back(0);
  vecy.push_back(h);
  
  sort(vecx.begin(),vecx.end());
  sort(vecy.begin(),vecy.end());
  vecx.erase(unique(vecx.begin(),vecx.end()),vecx.end());
  vecy.erase(unique(vecy.begin(),vecy.end()),vecy.end());

  for(int i=0;i<vecx.size();i++){
    dicx[vecx[i]] = i;
  }
  for(int i=0;i<vecy.size();i++){
    dicy[vecy[i]] = i;
  }
  
  vh = vecy.size()-1;
  vw = vecx.size()-1;
  
  for(int i=0;i<n;i++){ 
    if(( y1[i] == 0 || y1[i] == h || x1[i] == 0 || x1[i] == w ) &&
       ( y2[i] == 0 || y2[i] == h || x2[i] == 0 || x2[i] == w )){
      
      int p1 = calc(dicx[x1[i]],dicy[y1[i]]);
      int p2 = calc(dicx[x2[i]],dicy[y2[i]]);

      vec.push_back({abs(p1-p2),{min(p1,p2),max(p1,p2)}});
    }
  }

  sort(vec.begin(),vec.end());

  RMQ seg((vh+vw)*2+1), seg2((vh+vw)*2+1);

  for(int i=0;i<vec.size();i++){
    int p1 = vec[i].second.first;
    int p2 = vec[i].second.second;
    seg.set(p1,p2);
    seg2.set(p1,-p2);
    seg.set(p2,p1);
    seg2.set(p2,-p1);
  }
  
  for(int i=0;i<vec.size();i++){
    int p1 = vec[i].second.first;
    int p2 = vec[i].second.second;
    
    int q1 = seg.query(p1,p2);
    int q2 = -seg2.query(p1,p2);
    
    if(p1 <= q1 && q1 <= p2 &&
       p1 <= q2 && q2 <= p2){
    }else{
      puts("NO");
      return 0;
    }
    
  }

  puts("YES");
  
  
  return 0;
}


Measured memory_bytes: 38380