fun main(args : Array<String>) {
    val a1 = readLine()!!.split(" ").map { it.toInt() }
    val a2 = readLine()!!.split(" ").map { it.toInt() }
    val a3 = readLine()!!.split(" ").map { it.toInt() }
    val b1 = listOf(a1[0], a2[0], a3[0])
    val b2 = listOf(a1[1], a2[1], a3[1])
    val b3 = listOf(a1[2], a2[2], a3[2])
    val c1 = listOf(a1[0], a2[1], a3[2])
    val c2 = listOf(a1[2], a2[1], a3[0])

    val n = readLine()!!.toInt()
    val nn = mutableListOf<Int>()
    var bingo = false

    repeat(n) {
        nn.add(readLine()!!.toInt())
        if (bingo) return@repeat

        if (nn.containsAll(a1)) bingo = true
        if (nn.containsAll(a2)) bingo = true
        if (nn.containsAll(a3)) bingo = true
        if (nn.containsAll(b1)) bingo = true
        if (nn.containsAll(b2)) bingo = true
        if (nn.containsAll(b3)) bingo = true
        if (nn.containsAll(c1)) bingo = true
        if (nn.containsAll(c2)) bingo = true
    }

    println(if (bingo) "Yes" else "No")
}