fun main(args:Array<String>) {
    println(if(isBingo()) "Yes" else "No")
}

fun isBingo():Boolean {
    val card = (1..3).map { readLine()!!.split(" ").map { it.toInt() } }
    val logCount = readLine()!!.toInt()
    val log = (1..logCount).map { readLine()!!.toInt() }

    val flag = (1..3).map { (1..3).map { false }.toMutableList() }

    for(i in card.indices) {
        for(j in card[i].indices) {
            if(log.contains(card[i][j])) {
                flag[i][j] = true
            }
        }
    }

    if(flag.any { it.all { it } }) {
        return true
    }
    if((0 until 3).any { idx -> flag.all { it[idx] } }) {
        return true
    }
    if((0 until 3).all { flag[it][it] }) {
        return true
    }
    if((0 until 3).all { flag[2-it][it] }) {
        return true
    }
    return false
}