fun main(args: Array<String>) {
    val a = (1..3).map{
        readLine()!!.split(" ").map{it.toInt()}
    }
    val n = readLine()!!.toInt()
    var b = Array(n) {
        readLine()!!.toInt()
    }
    var bingo = Array(9) {false}
    bingo[0] = (0..2).map{a[it][it] in b}.all{it}
    bingo[1] = (0..2).map{a[it][2-it] in b}.all{it}
    for (i in 2..4)
        bingo[i] = (0..2).map{a[i-2][it] in b}.all{it}
    for (i in 5..7)
        bingo[i] = (0..2).map{a[it][i-5] in b}.all{it}
    println(if (bingo.any{it}) "Yes" else "No")
}
