#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int MOD = 1000000007;
template <typename T>
void __dump__(std::ostream &os, const T &first) {
  os << first;
}
template <typename First, typename... Rest>
void __dump__(std::ostream &os, const First &first, const Rest &...rest) {
  os << first << ", ";
  __dump__(os, rest...);
}
int h, w, n;
int i1[100010];
int lskdjfla[100010];
int i2[100010];
int j2[100010];
bool on_edge(int i, int j) {
  bool res = (j == 0 || j == w || i == 0 || i == h);
  return res;
}
int f(int i, int j) {
  assert(on_edge(i, j));
  if (j == 0) return i;
  if (i == h) return h + j;
  if (j == w) return h + w + (h - i);
  return h + w + h + (w - j);
}
bool solve() {
  using pii = pair<int, int>;
  deque<pii> ei;
  for (int i = (0); i < int(n); ++i) {
    if (on_edge(i1[i], lskdjfla[i]) && on_edge(i2[i], j2[i])) {
      int f1 = f(i1[i], lskdjfla[i]);
      int f2 = f(i2[i], j2[i]);
      ei.emplace_back(f1, i);
      ei.emplace_back(f2, i);
    }
  }
  sort(begin(ei), end(ei));
  int k = ei.size();
  deque<int> e;
  for (int i = (0); i < int(k); ++i) e.push_back(ei[i].second);
  if (k <= 1) return true;
  int p = 0;
  while (p < k && e[p] != e[(p - 1 + k) % k]) ++p;
  if (p == k) return false;
  while (p) {
    int t = e.front();
    e.pop_front();
    e.push_back(t);
    --p;
  }
  set<int> se;
  stack<int> s;
  for (auto &x : e) {
    if (se.count(x)) {
      if (s.size() == 0 || s.top() != x) return false;
      s.pop();
    } else {
      se.insert(x);
      s.push(x);
    }
  }
  return s.size() == 0;
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(0);
  while (cin >> h >> w >> n) {
    for (int i = (0); i < int(n); ++i) {
      cin >> i1[i] >> lskdjfla[i] >> i2[i] >> j2[i];
    }
    cout << (solve() ? "YES" : "NO") << endl;
  }
}
