fun main(args: Array<String>) {
    val bingoCard = Array(3) { readInputLine().split(" ").map { it.toInt() }.toIntArray() }
    val bingo = Array(3) { BooleanArray(3) }
    val N = readInputLine().toInt()
    for (i in 1..N) {
        val b = readInputLine().toInt()
        for (j in 0..2) {
            for (k in 0..2) {
                if (bingoCard[j][k] == b) {
                    bingo[j][k] = true
                }
            }
        }
    }

    for (i in 0 until 3) {
        if (bingo[i][0] && bingo[i][1] && bingo[i][2]) {
            println("Yes")
            return
        }
        if (bingo[0][i] && bingo[1][i] && bingo[2][i]) {
            println("Yes")
            return
        }
    }

    if (bingo[0][0] && bingo[1][1] && bingo[2][2]) {
        println("Yes")
        return
    }

    if (bingo[2][0] && bingo[1][1] && bingo[0][2]) {
        println("Yes")
        return
    }

    println("No")
}

fun readInputLine(): String {
    return readLine()!!
}
