#include <bits/stdc++.h>
using namespace std;
int r, c, n;
const int N = 210000;
int sta[N], top;
vector <pair <int, int> > V;
int calc(int x, int y)
{
    if (x > 0 && x < r && y > 0 && y < c) return -1;
    if (y == 0) return x;
    if (x == r) return r + y;
    if (y == c) return r + c + r - x;
    return r + c + r + c - y;
}
int main()
{
    scanf("%d%d%d", &r, &c, &n);
    for (int i = 1; i <= n; ++ i)
    {
        int x1, y1, x2, y2;
        scanf("%d%d%d%d", &x1, &y1, &x2, &y2);
        int d1 = calc(x1, y1), d2 = calc(x2, y2);
        if (d1 == -1 || d2 == -1) continue;
        if (d1 > d2) swap(d1, d2);
        V.push_back(make_pair(d1, i));
        V.push_back(make_pair(d2, i));
    }
    sort(V.begin(), V.end());
    for (int i = 0; i < V.size(); ++ i)
    {
        if (V[i].second == sta[top]) top --;
        else sta[++ top] = V[i].second;
    }
    if (!top) puts("YES"); else puts("NO");
}
