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 r = Array.fill(3, 3)(false)
    for {
      i <- 0 until 3
      j <- 0 until 3
    } for {
      k <- 0 until n
    } {
      if(A(i)(j) == B(k)) r(i)(j) = true
    }

    var ans = "No"
    for(i <- 0 until 3)
      if(r(0)(i) && r(1)(i) && r(2)(i)) ans = "Yes"
    for(i <- 0 until 3)
      if(r(i)(0) && r(i)(1) && r(i)(2)) ans = "Yes"
    if(r(0)(0) && r(1)(1) && r(2)(2)) ans = "Yes"
    if(r(0)(2) && r(1)(1) && r(2)(0)) ans = "Yes"
    ans
  }

  println(solve())

}

