#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#include <stack>
using namespace std;

int main(){
	int r,c,n;
	cin >> r >> c >> n;
	vector<pair<int,int> > p;
	for(int i=0; i<n; i++){
		int x[2], y[2];
		cin >> x[0] >> y[0] >> x[1] >> y[1];
		int dist[2] = {-1,-1};
		for(int j=0; j<2; j++){
			if(y[j]==0){
				dist[j] = x[j];
			}else if(x[j]==r){
				dist[j] = r +y[j];
			}else if(y[j]==c){
				dist[j] = r+c +(r-x[j]);
			}else if(x[j]==0){
				dist[j] = r+c+r +(c-y[j]);
			}
		}
		if(dist[0]!=-1 && dist[1]!=-1){
			p.push_back(make_pair(dist[0], i));
			p.push_back(make_pair(dist[1], i));
		}
	}
	sort(p.begin(), p.end());
	
	stack<int> st;
	for(int i=0; i<(int)p.size(); i++){
		if(st.empty() || st.top()!=p[i].second){
			st.push(p[i].second);
		}else{
			st.pop();
		}
	}
	if(st.empty()){
		cout << "YES" << endl;
	}else{
		cout << "NO" << endl;
	}
	return 0;
}