/*
                           _________________
                      ____/:::::::::::::::::\_____
                   __/::::::::::::::::::::::::::::\___
                 _/:::::::::::::::::::::::::::::::::::\__
               _/::::::::::::::::::::::::::::::::::::::::\_
              /::::::::::::::::::::::::::::::::::::::::::::\
             |::::::::::::::::::::::::::::::::::::::::::::::\
            /::::::::::::::::::::::::::::::::::::::::::::::::\
           |:::/.:::::::;:::::::::::::::::::::::::::::::::::::|
          /:::/.:::::::/..:::::::::::::::::::::::::::::::::::::\
         |:::|.::::::;/.::::::::::::::::::::::::::::::::::::::::|
         |::/.::::::/..:::::::;;'.::::::::::::::::::::::::::::::|
         |:|.::::/./.::::::;;/..:::::::::::::::::::::::::::::::::|
         `:|.:::|.|.:::::;/..;;;;;;-'.:;;;-':::::::::::::::::::::|
          \|.:::|.|.:::;/.;;/  -..::'''...:::::::::::::::::::::::|
           \;;::|.|.::/.;/--__      |::::::::::::::::::::::::::::|
              \;;\\::/|/ =-__ --_  /::::::::::::::::::::::::::::::
                  \\/    /|  -.   |.::::::::::::::::::::::::::::::
                 _.'    /|'   /=  ||::::::::::::::::::::::::::::::
             _.-'      //'        ||::::::::::::::::::::::::::::::
            (          -          `|::::::::::::::::::::::::::::::
             \                      \:::::::::::::::::::::::::::::
              |  (c)Kolansburg      \::::::::::::::::::::::::::::
             /                      __/:::::::::::::::::::::::::::
             \                   __/::;::;;:::::::::::::::::::::::
             (`                 /;;;;/::|  \::::::::::::::::::::::
             |                 |'_,::::/ \ |::::::::::::::::::::::
            .'                _/::::::/  / /:::::::::::::::. .::::
            |                /.::;;:-'_)/_/::::::::::::::::...::::
 ----.__    |               |.::|   \___/::::::::::::::::::...::::
 :::::::`----\_____          \:::\.-'::::::::::::::::::::::...::::
 ;;;;;:::::::::::::`------     \:::::::::::::::::::::::::::...::::
      `-------:::::::\         /:::::::::::::::::::::::::::...::::
 ___.--------'::::::::\       |::::::::::::::::::::::::::::...::::
 :::::;;;:--:::::::::::|      /::::::::::::::::::::::::::::...::::
 ----'  _,-:.:::::::::::\    |.::::::::::::::::::::::::::::...::::
     __/.::::::::::::::::|   |.::::::::::::::::::::::::::::...::::
  __/.:::;;::::::::;/.:::|   |.::::::::::::::::::::::::::::. .::::
 /.::::;/ /.:::::;/ |.::::|   \_.:::::::::::::::::::::::::::::::::
 :::::/  /.:::::/  /.:::::|     \__.::::::::::::::::::::::::::::::
 ::::|  |.:::::/  /.:::::.|        \,::::::::::::::::::::::::::::
 ::::|  |.::::|   |.:::::/|       __/::::::::::::::::::::::::::::
 \.:::\  \.:::|   |.::::||| __.--::::::::::::::::::::::::::::::::
  \.:::\_ \.:::\   \.:::'/.::::::::::::::::::::::::::::::::::::::
   \.::::\ \.:::\   \.::::::::::::::::::::::::::::::::::::::::::
*/
 
#define _CRT_SECURE_NO_WARNINGS
#include <set>
#include <map>
#include <queue>
#include <ctime>
#include <cmath>
#include <stack>
#include <random>
#include <bitset>
#include <string>
#include <vector>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <algorithm>
#include <functional>
#include <unordered_map>
using namespace std;

#define X first
#define Y second

const int N = 200100;
int n, r, c, x, y, xx, yy, so[N];
vector<pair<int, int> > g;
set<int> w;
set<int>::iterator le, pe;

bool chek(int vx, int vy)
{
	return  (vx == 0 || vy == 0 || vx == r || vy == c);		
}

int kach(int vx, int vy)
{
	if (vx == 0)
	{
		return vy;
	}
	if (vy == c)
	{
		return c + vx;
	}
	if (vx == r)
	{
		return r + c + (c - vy);
	}
	if (vy == 0)
	{
		return 2 * c + r + (r - vx);
	}
}

void adpo(int vx, int vy, int i)
{
	if (vx > vy)
		swap(vx, vy);
	so[i] = vy;
	g.push_back({ vx, i });
	g.push_back({ vx, i + n});
}


int main()
{
#if _DEBUG
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#else
	//freopen("parray.in", "r", stdin);
	//freopen("parray.out", "w", stdout);
#endif
	//ios::sync_with_stdio(0);
	cin >> r >> c >> n;
	for (int i = 0; i < n; i++)
	{
		cin >> x >> y >> xx >> yy;
		if (chek(x, y) && chek(xx, yy))
		{
			adpo(kach(x, y), kach(xx, yy), i);
		}
	}
	sort(g.begin(), g.end());
	for (int i = 0; i < g.size(); i++)
	{
		if (g[i].Y >= n)
		{
			w.erase(g[i].X);
		}
		else
		{
			le = w.lower_bound(g[i].X);
			pe = w.lower_bound(so[g[i].Y]);
			if (le != pe)
			{
				cout << "NO";
				return 0;
			}
			w.insert(so[g[i].Y]);
		}
	}
	cout << "YES";
	return 0;
}

Measured memory_bytes: 6896