import io.StdIn._
import scala.collection.mutable

object Main extends App {
  val line1 = readLine.split(" ").map(_.toInt)
  val line2 = readLine.split(" ").map(_.toInt)
  val line3 = readLine.split(" ").map(_.toInt)

  val N = readInt
  val numbers = mutable.Set.empty[Int]
  for (i <- 0 until N) {
    numbers.add(readInt)
  }

  val patterns = mutable.Set.empty[(Int, Int, Int)]
  patterns.add((line1(0), line1(1), line1(2)))
  patterns.add((line2(0), line2(1), line2(2)))
  patterns.add((line3(0), line3(1), line3(2)))

  patterns.add((line1(0), line2(0), line3(0)))
  patterns.add((line1(1), line2(1), line3(1)))
  patterns.add((line1(2), line2(2), line3(2)))

  patterns.add((line1(0), line2(1), line3(2)))
  patterns.add((line1(2), line2(1), line3(0)))

  val ans = patterns.exists { case (a, b, c) =>
    numbers.contains(a) && numbers.contains(b) && numbers.contains(c)
  }

  println(if (ans) "Yes" else "No")
}
