fun readString() = readLine()!!
fun readInt() = readLine()!!.toInt()
fun readLong() = readLine()!!.toLong()
fun readIntList() = readLine()!!.split(" ").map(String::toInt)
fun readLongList() = readLine()!!.split(" ").map(String::toLong)
fun <T> Array<Array<T>>.print() {
    this.forEach {
        println(it.joinToString(" "))
    }
}

fun main() {
    val card = Array(3) { Array(3) { 0 } }
    for (i in 0 until 3) {
        val row = readIntList()
        for (j in 0 until 3)  {
            card[i][j] = row[j]
        }
    }
    val n = readInt()
    val b = mutableListOf<Int>()
    for (i in 0 until n) {
        b.add(readInt())
    }

    // たて
    for (j in 0 until 3) {
        if (card[0][j] in b && card[1][j] in b && card[2][j] in b) {
            println("Yes")
            return
        }
    }

    // よこ
    for (i in 0 until 3) {
        if (card[i][0] in b && card[i][1] in b && card[i][2] in b) {
            println("Yes")
            return
        }
    }

    // 斜め
    if (card[0][0] in b && card[1][1] in b && card[2][2] in b || card[0][2] in b && card[1][1] in b && card[2][0] in b) {
        println("Yes")
        return
    }

    println("No")
}
