√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.zipWithIndex.forall {
      case (Array(x1, y1, x2, y2), i) =>
      val isSplit =
        (x1 == 0 || x1 == r) &&
        (y1 == 0 || y1 == c) &&
        (x2 == 0 || x2 == r) &&
        (y2 == 0 || y2 == c)
    
     if (isSplit) {
       lines.take(i).forall {
         case Array(x3, y3, x4, y4) =>
			val (Array(sortedX1, sortedX2), Array(sortedX3, sortedX4)) =
              (Array(x1, x2).sorted , Array(x3, x4))
			val (Array(sortedY1, sortedY2), Array(sortedY3, sortedY4)) =
              (Array(y1, y2).sorted , Array(y3, y4))
            val isConnectionFaield = 
               x1 < x3 && x2 > x4 || 
               y1 < y3 && y2 > y4
            !isConnectionFailed
       }
     } else {
       true
     }
  }
  
  println(if (yes) "YES" else "NO")
}