import java.util.*

fun BooleanArray.and() = this.reduce { a, b -> a && b }
fun BooleanArray.or() = this.reduce { a, b -> a || b }

data class Cell(val n: Int, var checked: Boolean)

fun main(args: Array<String>) {
  val a = Array(3) { readLine()!!.split(' ').map { Cell(it.toInt(), false) }}
  val n = readLine()!!.toInt()
  repeat(n) {
    val b = readLine()!!.toInt()
    checked@for (row in a) {
      for (col in row) {
        if (col.n == b) {
          col.checked = true
          break@checked
        }
      }
    }
  }
  val ans = BooleanArray(3) { i -> a[i][i].checked }.and()
    || BooleanArray(3) { i -> a[i][2 - i].checked }.and()
    || BooleanArray(3) { i -> BooleanArray(3) { j -> a[i][j].checked }.and() || BooleanArray(3) { j -> a[j][i].checked }.and() }.or()
  println(if (ans) "Yes" else "No")
}
