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

#define fi first
#define se second
#define pb push_back
#define ii pair<int, int>
#define mp make_pair
#define iii pair< int, pair<int, ii> >
#define ll long long
#define FOR(a, b, c) for(int a = b; a <= c; ++a)
const int N = 1e5 + 10;
const int oo = 1e9;
const int mod = 1e9 + 7;
struct book {
    int x, y, num;
}node[N];
int R, C, n, cnt, kt[N];
int load(int x, int y){
    int dist = 0;
    if(y == 0) dist = x;
    if(y == C) dist = R - x + 1 + R + C;
    if(x == 0) dist = 2*R + 2*C - y;
    if(x == R) dist = R + y;
    return dist;
}
bool cmp(const book x1, const book x2){
    return load(x1.x, x1.y) < load(x2.x, x2.y);
}

stack<int> st;
signed main()
{
    //freopen("test.txt", "r", stdin);
    ios_base::sync_with_stdio(false);
    cin >> R >> C >> n; 
    FOR(i, 1, n) {
        int x1, y1, x2, y2; cin >> x1 >> y1 >> x2 >> y2;
        if(x1 == 0 || x1 == R || y1 == 0 || y1 == C) {
            node[++cnt].x = x1, node[cnt].y = y1, node[cnt].num = i;
        }
        if(x2 == 0 || x2 == R || y2 == 0 || y2 == C){
            node[++cnt].x = x2, node[cnt].y = y2, node[cnt].num = i;
        }
    }
    sort(node + 1, node + 1+ cnt, cmp);
    FOR(i, 1, cnt)  {
        if(!kt[node[i].num])
            st.push(node[i].num), kt[node[i].num] = 1;
        else {
            if(st.top() != node[i].num){
                cout << "NO"; return 0;
            }
            else    st.pop();
        }
    }
    cout << "YES";
}
