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)(0)
    for {
      i <- 0 until 3
      j <- 0 until 3
      k <- 0 until n
    } {
      if(A(i)(j) == B(k)) r(i)(j) = 1
    }

    var ans = "No"
    for(i <- 0 until 3) {
      var cnt = 0
      for(j <- 0 until 3)
        cnt += r(i)(j)
      if(cnt == 3) ans = "Yes"
    }
    for(i <- 0 until 3) {
      var cnt = 0
      for(j <- 0 until 3)
        cnt += r(j)(i)
      if(cnt == 3) ans = "Yes"
    }
    for(i <- 0 until 3) {
      var cnt = 0
        cnt += r(i)(i)
      if(cnt == 3) ans = "Yes"
    }
    for(i <- 0 until 3) {
      var cnt = 0
      cnt += r(i)(2-i)
      if(cnt == 3) ans = "Yes"
    }
    ans
  }

  println(solve())

}

