import scala.collection.mutable._

object Main extends App {
  val Array(r, c, n) = io.StdIn.readLine.split(" ").map(_.toInt)
  
  val lines = 1.to(n).map { _ => io.StdIn.readLine.split(" ").map(_.toInt) }
  
  val yes = lines.forall {
      case Array(x1, y1, x2, y2) =>
      val isSplit =
        (x1 == 0 || x1 == r) &&
        (y1 == 0 || y1 == c) &&
        (x2 == 0 || x2 == r) &&
        (y2 == 0 || y2 == c); 
      !isSplit
    }
  
  println(if (yes) "YES" else "NO")
}