import scala.io.StdIn._

object Main extends App {

  val A = Array.fill(3)(readLine().split(" ").map(_.toInt))
  val n = readInt()
  val B = Array.fill(n)(readInt())



  def solve(): String = {
    val flatA = A.flatten
    val r = (0 to 8).map { i =>
      B.contains(flatA(i))
    }
    val pattern = Array(
      Array(r(0),r(1),r(2)),
      Array(r(3),r(4),r(5)),
      Array(r(6),r(7),r(8)),
      Array(r(0),r(3),r(6)),
      Array(r(1),r(4),r(7)),
      Array(r(2),r(5),r(8)),
      Array(r(0),r(4),r(8)),
      Array(r(2),r(4),r(6))
    )
    pattern.foreach { list =>
      if(list.forall(identity)) return "Yes"
    }
    "No"
  }

  println(solve())

}

