/*
 * E.cpp
 *
 *  Created on: 2017/06/18
 *      Author: jin
 */

//#define MYDEBUG
#include <bits/stdc++.h>

#ifdef MYDEBUG
#define dbp(x) cout<<#x<<": "<<x<<endl
#define dbp2(x,y) cout<<#x<<","<<#y<<": "<<x<<","<<y<<endl
#define dbp3(x,y,z) cout<<#x<<","<<#y<<","<<#z<<": "<<x<<","<<y<<","<<z<<endl
#define dbp4(w,x,y,z) cout<<#w<<","<<#x<<","<<#y<<","<<#z<<": "<<w<<","<<x<<","<<y<<","<<z<<endl
#define ifcin(x) std::ifstream cin(x)
#else
#define dbp(x)
#define dbp2(x,y)
#define dbp3(x,y,z)
#define dbp4(w,x,y,z)
#define ifcin(x)
#endif
#define ll long long
#define ull unsigned long long
#define all(x) x.begin(), x.end()
#define rep(i, from, to) for(int i=from; i<to; ++i)
#define REP(i, from, to) for(int i=from; i<=to; ++i)
#define EPS = 1e-14;
using std::vector;
using std::cout;
using std::cin;
using std::endl;
using std::max;
using std::min;
using std::swap;
using std::string;
using std::fill;
using std::pair;
using std::sort;
using std::reverse;
using std::pair;
using std::greater;
using std::priority_queue;
using std::ostream;

template<typename T>
ostream& operator<<(ostream& out, const vector<vector<T> >& v) {
  for (size_t i = 0; i < v.size(); ++i) {
    out << v[i] << endl;
  }
  return out;
}

template<typename T>
ostream& operator<<(ostream& out, const vector<T>& v) {
  out << "[";
  size_t last = v.size() - 1;
  for (size_t i = 0; i < v.size(); ++i) {
    out << v[i];
    if (i != last) {
      out << ",";
    }
  }
  out << "]";
  return out;
}
struct unionfind {
  vector<int> par;
  vector<int> rank;
  unionfind(int n) {
    par = vector<int>(n);
    rank = vector<int>(n);
    rep(i,0,n)
    { //0オリジン
      par[i] = i;
      rank[i] = 1;
    }
  }

  int find(int x) {
    if (par[x] == x) {
      return x;
    }
    return par[x] = find(par[x]);
  }

  bool same(int x, int y) {
    return find(x) == find(y);
  }

  void unite(int x, int y) { //rank[x] > rank[y]を保つ
    x = find(x);
    y = find(y);
    if (x == y) {
      return;
    }
    if (rank[x] < rank[y]) {
      swap(x, y);
    }
    par[y] = x;
    rank[x] += rank[y];
    rank[y] = 0;
  }

  int size(int x) {
    return rank[x];
  }
};

struct edge {
  int from, to;
  double cost;
  edge(int from, int to, double cost) {
    this->from = from;
    this->to = to;
    this->cost = cost;
  }

  edge() {
    *this = edge(-1, -1, -1);
  }

  bool operator<(const edge& e) const {
    return cost < e.cost;
  }
};

class Graph {
public:
  static ll kruskal(vector<edge>& es, int n) {
    sort(all(es));
    ll min_cost = 0;
    unionfind uf(n);
    rep(i,0,(int)es.size())
    {
      edge &e = es[i];
      if (!uf.same(e.from, e.to)) {
        min_cost += e.cost;
        uf.unite(e.from, e.to);
      }
    }
    return min_cost;
  }
};

int R, C, N;
typedef pair<ll, ll> P;
typedef pair<P, int> T;
vector<T> v;
std::stack<int> st;
ll offset = 2000000000;
bool onEdge(ll x, ll y) {
  return (x == 0 || x == R) || (y == 0 || y == C);
}

void slide(ll &x, ll &y) {
  if (x == 0) {
    x -= offset * 3;
  }
  if (y == C) {
    x -= offset * 2;
  }
  if (x == R) {
    x -= offset * 1;
    y *= -1;
  }
  if (y == 0) {
    x *= -1;
  }
}

void solve() {
  cin >> R >> C >> N;
  REP(i, 1, N)
  {
    ll x1, y1, x2, y2;
    cin >> x1 >> y1 >> x2 >> y2;
    if (onEdge(x1, y1) && onEdge(x2, y2)) {
      slide(x1, y1);
      slide(x2, y2);
      v.push_back(T(P(x1, y1), i));
      v.push_back(T(P(x2, y2), i));
    }
  }

//sortする(????)
  sort(v.begin(), v.end());
  rep(i,0,(int)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);
      }
    }
    dbp4(v[i].second, v[i].first.first, v[i].first.second, st.size());
  }
  if (st.empty()) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
}

int main() {
  solve();
}



Measured memory_bytes: 8432