fun main(args: Array<String>) {
    val aArray = Array(3) { readIntegerList().map { Pair(it, false) }.toTypedArray() }
    val n = readInteger()
    repeat(n) {
        val b = readInteger()
        for (i in aArray.indices) {
            for (j in aArray[i].indices) {
                if (aArray[i][j].first == b) {
                    aArray[i][j] = Pair(aArray[i][j].first, true)
                }
            }
        }
    }
    
    for (i in 0..2) {
        val trueCount = aArray[i].count { it.second }
        if (trueCount == 3) {
            println("Yes")
            return
        }
    }

    for (i in 0..2) {
        var trueCount = 0
        for (j in 0..2) {
            if (aArray[j][i].second) {
                trueCount++
            }
        }

        if (trueCount == 3) {
            println("Yes")
            return
        }
    }

    if (aArray[0][0].second && aArray[1][1].second && aArray[2][2].second) {
        println("Yes")
        return
    }

    if (aArray[0][2].second && aArray[1][1].second && aArray[2][0].second) {
        println("Yes")
        return
    }
    
    println("No")
}

fun readInteger() = readLine()!!.toInt()
fun readLong() = readLine()!!.toLong()
fun readStringList() = readLine()!!.split(" ")
fun readIntegerList() = readStringList().map(String::toInt)
fun readLongList() = readStringList().map(String::toLong)
