import java.util.Scanner

object Main extends App {
  val sc = new Scanner(System.in)
  val A = Array.fill(3, 3)(sc.nextInt)
  val N = sc.nextInt
  val b = Array.fill(N)(sc.nextInt)

  val x = A.map(_.map(b.contains(_)))
  val y = {
    val d = x.exists(x => x.forall(y => y))
    val e = x.transpose.exists(x => x.forall(y => y))
    val f = x(0)(0) && x(1)(1) && x(2)(2)
    val g = x(0)(2) && x(1)(1) && x(2)(0)

    d || e || f || g
  }
  val z = if (y) "Yes" else "No"
  println(z)
}
