#include <bits/stdc++.h>
#define FOR(v, a, b) for(int v = (a); v < (b); ++v)
#define FORE(v, a, b) for(int v = (a); v <= (b); ++v)
#define REP(v, n) FOR(v, 0, n)
#define REPE(v, n) FORE(v, 0, n)
#define REV(v, a, b) for(int v = (a); v >= (b); --v)
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define ITR(it, c) for(auto it = (c).begin(); it != (c).end(); ++it)
#define RITR(it, c) for(auto it = (c).rbegin(); it != (c).rend(); ++it)
#define EXIST(c,x) ((c).find(x) != (c).end())
#define LLI long long int
#define fst first
#define snd second
#define popcount __builtin_popcount

#ifdef DEBUG
#include <misc/C++/Debug.cpp>
#else
#define dump(x) ((void)0)
#endif

#define gcd __gcd

using namespace std;
template <class T> constexpr T lcm(T m, T n){return m/gcd(m,n)*n;}

template <typename I> void join(ostream &ost, I s, I t, string d=" "){for(auto i=s; i!=t; ++i){if(i!=s)ost<<d; ost<<*i;}ost<<endl;}
template <typename T> istream& operator>>(istream &is, vector<T> &v){for(auto &a : v) is >> a; return is;}
template <typename T, typename U> istream& operator>>(istream &is, pair<T,U> &p){is >> p.first >> p.second; return is;}

template <typename T, typename U> bool chmin(T &a, const U &b){return (a>b ? a=b, true : false);}
template <typename T, typename U> bool chmax(T &a, const U &b){return (a<b ? a=b, true : false);}
template <typename T, size_t N, typename U> void fill_array(T (&a)[N], const U &v){fill((U*)a, (U*)(a+N), v);}


struct point{
  int x, y;
  point(): x(0), y(0){}
  point(int x, int y): x(x), y(y){}
  point& operator+=(const point &a){this->x+=a.x; this->y+=a.y; return *this;}
  point& operator-=(const point &a){this->x-=a.x; this->y-=a.y; return *this;}

};

point operator+(const point &a, const point &b){return point(a.x+b.x, a.y+b.y);}
point operator-(const point &a, const point &b){return point(a.x-b.x, a.y-b.y);}
bool operator==(const point &a, const point &b){return a.x==b.x and a.y==b.y;}
bool operator!=(const point &a, const point &b){return !(a==b);}

bool operator<(const point &a, const point &b){
  if(a.x == b.x) return a.y < b.y;
  else return a.x < b.x;
}

bool operator<=(const point &a, const point &b){
  return (a<b) or (a==b);
}

bool operator>(const point &a, const point &b){
  return not (a<=b);
}

bool operator>=(const point &a, const point &b){
  return not (a<b);
}


ostream& operator<<(ostream &os, const point &a){
  os << "(" << a.x << "," << a.y << ")";
  return os;
}


int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);

  int R,C,N;
  while(cin >> R >> C >> N){

    vector<pair<int,int>> pp;

    
    REP(i,N){
      int x1,y1,x2,y2; cin >> x1 >> y1 >> x2 >> y2;

      if((x1 == 0 or x1 == R or y1 == 0 or y1 == C) and (x2 == 0 or x2 == R or y2 == 0 or y2 == C)){
	{
	  int k;
	  if(y1 == 0) k = x1;
	  else if(x1 == R) k = R + y1;
	  else if(y1 == C) k = R+C + (R-x1);
	  else k = R+C+R + (C-y1);
	  
	  pp.push_back({k,i});
	}
	{
	  int k;
	  if(y2 == 0) k = x2;
	  else if(x2 == R) k = R + y2;
	  else if(y2 == C) k = R+C + (R-x2);
	  else k = R+C+R + (C-y2);
	  
	  pp.push_back({k,i});
	}
      }
    }



    sort(ALL(pp));

    stack<int> st;

    for(auto &p : pp){
      if(st.empty()) st.push(p.snd);
      else{
	if(st.top() == p.snd) st.pop();
	else st.push(p.snd);
      }
    }

    bool ans = st.empty();

    cout << (ans ? "YES" : "NO") << endl;

  }
  
  return 0;
}


Measured memory_bytes: 2420