//ui gioi oi de vai lon
#include<bits/stdc++.h>
using namespace std;

// Shortcut

#define int long long
#define endl '\n'
#define eb emplace_back
#define pb push_back
#define pob pop_back
#define mp make_pair
#define upb upper_bound
#define lwb lower_bound
#define fi first
#define se second
#define For(i, l, r) for (int i = l; i < r; i++)
#define ForE(i, l, r) for (int i = l; i <= r; i++)
#define Ford(i, r, l) for (int i = r; i > l; i--)
#define FordE(i, r, l) for (int i = r; i >= l; i--)
#define Fora(i, a) for (auto i : a)

// I/O & Debug

#define PrintV(a) for (int iiii = 0; iiii < a.size(); iiii++) cout << a[iiii] << ' ';
#define PrintVl(a) for (int iiii = 0; iiii < a.size(); iiii++) cout << a[iiii] << endl;
#define PrintA(a, n) for (int iiii = 0; iiii < n; iiii++) cout << a[iiii] << ' ';
#define PrintAl(a, n) for (int iiii = 0; iiii < n; iiii++) cout << a[iiii] << endl;
#define Ptest(x) return cout << x, 0;
#define gl(s) getline(cin, s);
#define setpre(x) fixed << setprecision(x)
/*
#define debug(args...){ string _sDEB = #args; replace(_sDEB.begin(), _sDEB.end(), ',', ' '); stringstream _ssDEB(_sDEB); istream_iterator<string> _itDEB(_ssDEB); DEB(_itDEB, args); }
void DEB(istream_iterator<string> it) {}
template<typename T, typename... Args>
void DEB(istream_iterator<string> it, T a, Args... args){
    cout << *it << " = " << a << endl;
    DEB(++it, args...);
}
*/

// Functions

//#define isvowel(a) (a == 'a' || a == 'e' || a == 'i' || a == 'o' || a == 'u')
#define bend(a) a.begin(), a.end()
#define rbend(a) a.rbegin(), a.rend()
#define mset(a) memset(a, 0, sizeof(a));
//mt19937 rando(chrono::steady_clock::now().time_since_epoch().count());

// Data Structure

#define pque priority_queue
#define mts multiset
typedef long long ll;
typedef long double ld;
typedef vector <int> vi;
typedef vector <ll> vll;
typedef vector <ld> vld;
typedef vector <string> vs;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef vector <vi > vvi;
typedef vector <vll > vvll;
typedef vector <pii > vpii;
typedef vector <pll > vpll;

const int N = 1e5 + 5, mod = 1e9 + 7, inf = 1e18 + 5;

struct node{
    int x, y, idx;
    bool operator < (const node &a) const{
        if (a.x != x) return x < a.x;
        return y < a.y;
    }
};

int r, c, n;
vi both;
vector <node> e1, e2, e3, e4;
stack <int> st;
bool cnt[N];

bool onedge(int x, int y){
    return x == 0 || x == r || y == 0 || y == c;
}

signed main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    cin >> r >> c >> n;
    ForE(i, 1, n){
        int x1, y1, x2, y2;
        cin >> x1 >> y1 >> x2 >> y2;
        if (onedge(x1, y1) && onedge(x2, y2)){
            if (x1 == 0){
                e1.pb((node){x1, y1, i});
            }
            else if (y1 == c){
                e2.pb((node){x1, y1, i});
            }
            else if (x1 == r){
                e3.pb((node){x1, y1, i});
            }
            else if (y1 == 0){
                e4.pb((node){x1, y1, i});
            }
            if (x2 == 0){
                e1.pb((node){x2, y2, i});
            }
            else if (y2 == c){
                e2.pb((node){x2, y2, i});
            }
            else if (x2 == r){
                e3.pb((node){x2, y2, i});
            }
            else if (y2 == 0){
                e4.pb((node){x2, y2, i});
            }
        }
    }
    sort(bend(e1));
    sort(bend(e2));
    sort(rbend(e3));
    sort(rbend(e4));
    Fora(v, e1){
        //cout << v.x << ' ' << v.y << ' ' << v.idx << endl;
        if (!cnt[v.idx]){
            cnt[v.idx] = 1;
            st.push(v.idx);
        }
        else{
            if (st.top() != v.idx) Ptest("NO");
            st.pop();
        }
    }
    //cout << endl;
    Fora(v, e2){
        //cout << v.x << ' ' << v.y << ' ' << v.idx << endl;
        if (!cnt[v.idx]){
            cnt[v.idx] = 1;
            st.push(v.idx);
        }
        else{
            if (st.top() != v.idx) Ptest("NO");
            st.pop();
        }
    }
    //cout << endl;
    Fora(v, e3){
        //cout << v.x << ' ' << v.y << ' ' << v.idx << endl;
        if (!cnt[v.idx]){
            cnt[v.idx] = 1;
            st.push(v.idx);
        }
        else{
            if (st.top() != v.idx) Ptest("NO");
            st.pop();
        }
    }
    //cout << endl;
    Fora(v, e4){
        //cout << v.x << ' ' << v.y << ' ' << v.idx << endl;
        if (!cnt[v.idx]){
            cnt[v.idx] = 1;
            st.push(v.idx);
        }
        else{
            if (st.top() != v.idx) Ptest("NO");
            st.pop();
        }
    }
    cout << "YES";
}

/*
==================================+
INPUT:                            |
------------------------------    |

------------------------------    |
==================================+
OUTPUT:                           |
------------------------------    |

------------------------------    |
==================================+
*/

Measured memory_bytes: 8224