object Main extends App{
  import scala.io.StdIn
  val a =  for(i <- 1 to 3) yield StdIn.readLine().split(" ").map(_.toInt)
  val n = StdIn.readInt()
  val nums = for (i <- 1 to n) yield StdIn.readInt()
  val bingoPattern = Seq(((0,0),(0,1),(0,2)), ((1,0),(1,1),(1,2)), ((2,0),(2,1),(2,2)), ((0,0),(1,0),(2,0)),
                        ((0,1),(1,1),(2,1)), ((0,2),(1,2),(2,2)), ((0,0), (1,1), (2,2)), ((0,2),(1,1),(2,0)))
  val isBingo = bingoPattern.map {
    case (p1, p2, p3)
      if nums.contains(a(p1._1)(p1._2)) && nums.contains(a(p2._1)(p2._2)) && nums.contains(a(p3._1)(p3._2))
      => "Bingo"
    case _ => "No"
  }
  println(if (isBingo.contains("Bingo")) "Yes" else "No")
}