package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
)

func configure(scanner *bufio.Scanner) {
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 1000005), 1000005)
}
func getNextString(scanner *bufio.Scanner) string {
	scanned := scanner.Scan()
	if !scanned {
		panic("scan failed")
	}
	return scanner.Text()
}
func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}
func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}
func getNextFloat64(scanner *bufio.Scanner) float64 {
	i, _ := strconv.ParseFloat(getNextString(scanner), 64)
	return i
}
func main() {
	fp := os.Stdin
	wfp := os.Stdout
	extra := 0
	if os.Getenv("I") == "IronMan" {
		fp, _ = os.Open(os.Getenv("END_GAME"))
		extra = 100
	}
	scanner := bufio.NewScanner(fp)
	configure(scanner)
	writer := bufio.NewWriter(wfp)
	defer func() {
		r := recover()
		if r != nil {
			fmt.Fprintln(writer, r)
		}
		writer.Flush()
	}()
	solve(scanner, writer)
	for i := 0; i < extra; i++ {
		fmt.Fprintln(writer, "-----------------------------------")
		solve(scanner, writer)
	}
}
func solve(scanner *bufio.Scanner, writer *bufio.Writer) {
	r := getNextInt(scanner)
	c := getNextInt(scanner)
	n := getNextInt(scanner)
	pp := make(pairs, 0)
	rr := make([]int, 0)
	for i := 0; i < n; i++ {
		x1 := getNextInt(scanner)
		y1 := getNextInt(scanner)
		x2 := getNextInt(scanner)
		y2 := getNextInt(scanner)
		if 0 < x1 && x1 < r && 0 < y1 && y1 < c {
			continue
		}
		if 0 < x2 && x2 < r && 0 < y2 && y2 < c {
			continue
		}
		p1, p2 := index(x1, y1, r, c), index(x2, y2, r, c)
		if p1 > p2 {
			p1, p2 = p2, p1
		}
		rr = append(rr, p1)
		rr = append(rr, p2)
		pp = append(pp, pair{p1, p2})
	}
	cmp := newCompress(rr)
	sort.SliceStable(pp, pp.less)
	seg := newSegment(len(pp)*2 + 1)
	for i := 0; i < len(pp); i++ {
		if seg.query(cmp.get(pp[i][0]), cmp.get(pp[i][1]), 0, seg.add) > 0 {
			fmt.Fprintln(writer, "NO")
			return
		}
		seg.update(cmp.get(pp[i][1]), 1, seg.add)
	}
	fmt.Fprintln(writer, "YES")
}
func index(x, y, r, c int) int {
	if x == 0 {
		return y
	}
	if y == c {
		return x + y
	}
	if x == r {
		return r + c + c - y
	}
	return r*2 + c*2 - x
}

type pair [2]int

type pairs []pair

func (p pairs) less(i, j int) bool {
	return p[i][0] < p[j][0]
}

type compress map[int]int

func newCompress(aa []int) compress {
	n := len(aa)
	bb := make([]int, n)
	copy(bb, aa)
	sort.SliceStable(bb, func(i, j int) bool {
		return bb[i] < bb[j]
	})
	c := compress{}
	l := 0
	i := 0
	for r := 0; r < n; r++ {
		for r > l && bb[r] != bb[l] {
			l++
		}
		if r == l {
			c[bb[l]] = i
			i++
		}
	}
	return c
}
func (c compress) get(x int) int {
	return c[x]
}

type segment [][]int

func newSegment(n int) segment {
	seg := make(segment, 0)
	for n > 1 {
		seg = append(seg, make([]int, n))
		n = (n + 1) >> 1
	}
	seg = append(seg, make([]int, 1))
	return seg
}
func (seg segment) update(i int, v int, f func(x, y int) int) {
	seg[0][i] = v
	for h := 1; h < len(seg); h++ {
		i >>= 1
		if i<<1+1 < len(seg[h-1]) {
			seg[h][i] = f(seg[h-1][i<<1], seg[h-1][i<<1+1])
		} else {
			seg[h][i] = seg[h-1][i<<1]
		}
	}
}
func (seg segment) query(l, r int, s int, f func(x, y int) int) int {
	for h := 0; h < len(seg) && l < r; h++ {
		if l&1 == 1 {
			s = f(s, seg[h][l])
			l++
		}
		l >>= 1
		if r&1 == 1 {
			s = f(s, seg[h][r-1])
		}
		r >>= 1
	}
	return s
}
func (seg segment) add(x, y int) int {
	return x + y
}


Measured memory_bytes: 21636