fun main(args: Array<String>) = abc157b()

fun abc157b() {
    val aList = (1..3).map { readLine()!!.split(' ').map { it.toInt() } }
    val n = readLine()!!.toInt()
    val bList = (1..n).map { readLine()!!.toInt() }

    val list = Array(3) { BooleanArray(3) }

    bList.forEach { b ->
        for ((index, row) in aList.withIndex()) {
            for ((index2, a) in row.withIndex()) {
                if (a == b) list[index][index2] = true
            }
        }
    }

    for (i in 0..2) {
        if (list[i].all { it }) return println("Yes")
    }

    if (list.all { it[0] } || list.all { it[1] } || list.all { it[2] }) return println("Yes")

    if ((list[0][0] && list[1][1] && list[2][2]) || (list[0][2] && list[1][1] && list[2][0])) return println("Yes")

    println("No")
}
