#include <iostream>
#include <fstream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <cstdlib>
#include <cstdio>
#include <string>
#include <cstring>
#include <cassert>
#include <utility>
#include <iomanip>
#include <chrono>
#include <random>
#include <bitset>

using namespace std;

#define sz(x) (int) x.size()
#define unique(x) x.erase(unique(x.begin(), x.end()), x.end())
#define all(a) a.begin(), a.end()
#define sqr(x) ((x) * (x)) 
#define y1 aksjdaskdjksjfksdjf
#define left kdnvldvoiwejifejg
#define right lkdsjflksdjfdjfk
#define prev asdasfsadjkjsdfjs
#define tm aklsjdasjdasjdkdjjf
#define lcm hddalkwjeidjjhasda
#define random_shuffle asdasdd

const int MAXN = 105000;

int r, c, n;
int x1[MAXN], y1[MAXN], x2[MAXN], y2[MAXN];
bool ok = true;

bool isSide(int i) {
  return ((x1[i] == 0 || x1[i] == r) || (y1[i] == 0 || y1[i] == c)) && 
         ((x2[i] == 0 || x2[i] == r) || (y2[i] == 0 || y2[i] == c));
}

void check() {
  vector< pair <int, pair<int, int> > > v;
  set<int> upDown;
  for (int i = 0; i < n; i++) {
    // cerr << x1[i] << " " << y1[i] << " " << x2[i] << " " << y2[i] << endl;
    if (y1[i] == 0) {
      v.push_back({x1[i], {0, i}});
    }
    if (y2[i] == 0) {
      v.push_back({x2[i], {1, i}});
    }
    if ((x1[i] == 0 && x2[i] == r) || (x2[i] == 0 && x1[i] == r)) {
      upDown.insert(i);
    }
  }
  sort(all(v));

  set<int> st; // up side
  set<int> st2; // right side
  for (int i = 0; i < sz(v); i++) {
    int idx = v[i].second.second;
    int xx = (v[i].second.first == 0 ? x2[idx] : x1[idx]);
    int yy = (v[i].second.first == 0 ? y2[idx] : y1[idx]);
    if (xx == 0) {
      st.insert(yy);
    }
    if (yy == c) {
      st2.insert(xx);
    }
  }

  bool otherSide = false;
  int mxX = -1;
  set<int> stX;
  for (int i = 0; i < sz(v); i++) {
    int idx = v[i].second.second;
    // cerr << idx << endl;
    int xx = (v[i].second.first == 0 ? x2[idx] : x1[idx]);
    int yy = (v[i].second.first == 0 ? y2[idx] : y1[idx]);
    if (xx == 0) {
      st.erase(yy);
      if (sz(st) && (*st.begin() <= yy)) {
        // cerr << "h1" << endl;
        ok = false;
      }
      if (otherSide) {
        // cerr << "h2" << endl;
        ok = false;
      }
    }
    if (yy == 0) {
      auto it = stX.upper_bound(v[i].first);
      if (it != stX.end() && *it <= xx) {
        // cerr << "h3" << endl;
        ok = false;
      }
      // if (mxX > v[i].first) {
      //   cerr << "h3" << endl;
      //   ok = false;
      // }
      mxX = max(mxX, xx);
      stX.insert(xx);
    } else {
      if (mxX >= v[i].first) {
        // cerr << "h6" << endl;
        ok = false;
      }
    }
    if (yy == c) {
      st2.erase(xx);
      if (sz(st2) && (*st2.begin() <= xx)) {
        // cerr << "h4" << endl;
        ok = false;
      }
      int thisUpDown = upDown.count(idx);
      if (sz(upDown) - thisUpDown) {
        // cerr << "h5" << endl;
        ok = false;
      }
    }
    if (xx != 0 && yy != 0) {
      otherSide = true;
    }
  }
}

void rotate(int &x, int &y) {
  int tmp = y;
  y = x;
  x = c - tmp;
}

void rotate() {
  for (int i = 0; i < n; i++) {
    rotate(x1[i], y1[i]);
    rotate(x2[i], y2[i]);
  }
  swap(r, c);
}

int main() { 

  scanf("%d %d %d", &r, &c, &n);
  for (int i = 0; i < n; i++) {
    scanf("%d %d %d %d", &x1[i], &y1[i], &x2[i], &y2[i]);
  }

  vector<int> v;
  for (int i = 0; i < n; i++) {
    if (isSide(i)) {
      v.push_back(i);
    }
  }
  for (int i = 0; i < sz(v); i++) {
    int idx = v[i];
    x1[i] = x1[idx]; x2[i] = x2[idx];
    y1[i] = y1[idx]; y2[i] = y2[idx];
  }
  n = sz(v);
  cerr << "new n : " << n << endl;

  for (int i = 0; i < 4; i++) {
    check();
    // cerr << ok << endl; 
    rotate(); 
  }

  if (ok) {
    puts("YES");
  } else {
    puts("NO");
  }

  return 0;
}


Measured memory_bytes: 5972