open System
open System.Collections.Generic

module InputUtility =
    let InputTokens = new Queue<string>()

    let EnsureInput () =
        if InputTokens.Count = 0 then
            let input = Console.ReadLine ()
            let s = input.Split ([|' '|], StringSplitOptions.RemoveEmptyEntries)
            if s.Length > 0 then
                for x in s do InputTokens.Enqueue(x)
                true
            else false
        else true

    let rec ReadNext () =
        if EnsureInput () then InputTokens.Dequeue ()
        else ReadNext ()

    let ReadNextInt () = ReadNext () |> int

    let Read2Int () = ReadNextInt (), ReadNextInt ()

    let Read3Int () = ReadNextInt (), ReadNextInt (), ReadNextInt ()

    let ReadListOf f n =
        let rec loop acc = function
            | 0 -> List.rev acc
            | c -> loop ((ReadNext () |> f) :: acc) (c-1)
        loop [] n

    let MultipleCaseWithId f =
        let caseNum = ReadNextInt ()
        let rec loop index =
            if index = caseNum then ()
            else
                f index
                loop (index + 1)
        loop 0

    let MultipleCase f = MultipleCaseWithId (fun _ -> f ())

    let ReadList n =
        let rec loop acc = function
            | 0 -> List.rev acc
            | c -> loop (ReadNext () :: acc) (c-1)
        loop [] n

open InputUtility

module ARC076 =
    let Connected () =
        let r, c, n = Read3Int ()
        let rd = r + c + r + c
        let toP (x, y) =
            if y = 0 then x
            elif x = r then r + y
            elif y = c then r + c + r - x
            elif x = 0 then rd - y
            else -1
        let gp = Read2Int >> toP
        let rec loop i arr =
            if i = n then arr |> Seq.toArray
            else
                let p1, p2 = gp (), gp ()
                let na =
                    if p1 = -1 || p2 = -1 then arr
                    else (p1, p2) :: arr
                loop (i + 1) na
        let ls = loop 0 []
        let test d =
            let g x =
                let nx = x - d
                if nx < 0 then rd + nx else nx
            let ps =
                ls
                |> Seq.mapi (fun i p -> i + 1, p)
                |> Seq.collect (fun (i1, (p1, p2)) ->
                    let q1, q2 = g p1, g p2
                    let s1, s2 = if q2 > q1 then q1, q2 else q2, q1
                    [s1, i1; s2, -i1])
                |> Seq.sort
                |> Seq.toArray
            //printfn "[%d] %A" d ps
            let pn = Array.length ps
            let stack = new System.Collections.Generic.Stack<_> ()
            let rec inner c =
                if c = pn then true
                else
                    let _, i = ps.[c]
                    if i < 0 then
                        if stack.Pop () <> -i then false
                        else inner (c + 1)
                    else
                        stack.Push i
                        inner (c + 1)
            inner 0
        let valid = [0; r; r + c; r + c + r] |> Seq.exists test
        if valid then "YES" else "NO"
        |> printfn "%s"

    let Entry = Connected

ARC076.Entry ()