import java.io.{BufferedOutputStream, BufferedReader, InputStreamReader, PrintWriter}

object Main {
  def main(args: Array[String]): Unit = {
    val in = new BufferedReader(new InputStreamReader(System.in))
    val out = new PrintWriter(new BufferedOutputStream(System.out))

    val as = Array.ofDim[Int](3, 3)

    for {
      i <- 0 until 3
    } {
      as(i) = in.readLine().split("\\s").map(_.toInt)
    }

    val n = in.readLine().toInt

    for {
      _ <- 0 until n
    } {
      val b = in.readLine().toInt
      for {
        i <- 0 until 3
        j <- 0 until 3
        if as(i)(j) == b
      } {
        as(i)(j) = -1
      }
    }

    for {
      i <- 0 until 3
    } {
      if (as(i).forall(_ == -1)) {
        out.println("Yes")
        out.flush()
        return
      }
    }

    for {
      j <- 0 until 3
    } {
      if (as.map(a => a(j)).forall(_ == -1)) {
        out.println("Yes")
        out.flush()
        return
      }
    }

    if (as(0)(0) == -1 && as(1)(1) == -1 && as(2)(2) == -1) {
      out.println("Yes")
      out.flush()
      return
    }

    if (as(0)(2) == -1 && as(1)(1) == -1 && as(2)(0) == -1) {
      out.println("Yes")
      out.flush()
      return
    }

    out.println("No")
    out.flush()
  }
}
