// tested by Hightail - https://github.com/dj3500/hightail
import std.stdio, std.string, std.conv, std.algorithm;
import std.range, std.array, std.math, std.typecons, std.container, core.bitop;

int r, c, n;

void main() {
    scan(r, c, n);

    long x1, y1, x2, y2;

    alias Point = Tuple!(long, "d", int, "idx");

    auto p = new Point[](0);

    foreach (i ; 0 .. n) {
        scan(x1, y1, x2, y2);

        if (ontheEdge(x1, y1) && ontheEdge(x2, y2)) {
            if (x1 == 0 || y1 == c) {
                p ~= Point(x1 + y1, i);
            }
            else {
                p ~= Point(2L * r + 2L * c - x1 - y1, i);
            }

            if (x2 == 0 || y2 == c) {
                p ~= Point(x2 + y2, i);
            }
            else {
                p ~= Point(2L * r + 2L * c - x2 - y2, i);
            }
        }
    }

    p.sort();

    debug {
        writeln(p);
    }

    auto st = Stack!int(n + 10);

    foreach (i ; 0 .. p.length.to!int) {
        if (st.empty || st.top != p[i].idx) {
            st.push(p[i].idx);
        }
        else {
            st.pop();
        }
    }

    if (st.empty) {
        writeln("YES");
    }
    else {
        writeln("NO");
    }
}

bool ontheEdge(long x, long y) {
    return x == 0 || x == r || y == 0 || y == c;
}


void scan(T...)(ref T args) {
    string[] line = readln.split;
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}


struct Stack(T) {
private:
    int N, peek;
    T[] data;

public:
    this(int size) 
    {
        N = size;
        data = new T[](N);
    }

    bool empty() @property
    {
        return peek == 0;
    }

    bool full() @property
    {
        return peek == N;
    }

    void push(T x) @property
    {
        assert(!full);
        data[peek++] = x;
    }

    void pop() @property
    {
        assert(!empty);
        --peek;
    }

    T top() @property
    {
        return data[peek - 1];
    }

    void clear() @property
    {
        peek = 0;
    }

    int length() @property
    {
        return peek;
    }

}