#include <bits/stdc++.h>
using namespace std;

int main() {
    int r, c, n;
    scanf("%d%d%d", &r, &c, &n);

    auto GetCoord = [&](int x, int y) {
        if (x != 0 && x != r && y != 0 && y != c) return -1;
        if (y == 0) return x;
        if (x == r) return y + r;
        if (y == c) return r + c + r - x;
        return r + c + r + c - y;
    };

    vector<int> lv(n);
    vector<pair<int, int>> rv;
    set<int> s;
    for (int i = 0; i < n; ++i) {
        int x1, y1, x2, y2;
        scanf("%d%d%d%d", &x1, &y1, &x2, &y2);
        int a = GetCoord(x1, y1);
        int b = GetCoord(x2, y2);
        if (a == -1 || b == -1) continue;
        if (a > b) swap(a, b);
        s.insert(a);
        lv[i] = a;
        rv.emplace_back(b, i);
    }
    sort(rv.begin(), rv.end());
    for (int i = 0; i < rv.size(); ++i) {
        s.erase(lv[rv[i].second]);
        auto it = s.lower_bound(rv[i].first);
        if (it != s.begin() && *prev(it) > lv[rv[i].second]) {
            puts("NO");
            return 0;
        }
    }
    puts("YES");
    return 0;
}
