#include <stack>
#include <algorithm>
#include <vector>
#include <iostream>
using namespace std;
typedef pair<int, int> P;

int encode(int x, int y, int r, int c) {
    if (y == 0) return x;
    if (x == r) return r + y;
    if (y == c) return r + c + (r - x);
    if (x == 0) return 2*r + 2*c - y;
    return -1;
}

int main(int argc, char** argv) {
    int r, c, n; cin >> r >> c >> n;
    vector<P> pts;
    for (int i = 0; i < n; i++) {
        int x1, y1, x2, y2; cin >> x1 >> y1 >> x2 >> y2;
        int n1 = encode(x1, y1, r, c), n2 = encode(x2, y2, r, c);
        if (n1 == -1 || n2 == -1) continue;
        pts.push_back(make_pair(min(n1, n2), max(n1, n2)));
    }
    sort(pts.begin(), pts.end());
    stack<int> s;
    for (P p : pts) {
        int n1 = p.first, n2 = p.second;
        while (!s.empty() && s.top() < n1) s.pop();
        if (!s.empty() && s.top() < n2) { cout << "NO\n"; return 0; }
        else s.push(n2);
    }
    cout << "YES\n";
}
