fun main(args: Array<String>) {
    val a = Array(3) { listOf<Int>() }

    a[0] = readIntList()
    a[1] = readIntList()
    a[2] = readIntList()

    val n = readInt()
    //val b = List(n) { readInt() }
    val b = mutableListOf<Int>()
    repeat(n) {
        b.add(readInt())
    }
    if (
        b.containsAll(a[0]) || b.containsAll(a[1]) || b.containsAll(a[2]) ||
        b.containsAll(listOf(a[0][0], a[1][0], a[2][0])) ||
        b.containsAll(listOf(a[0][1], a[1][1], a[2][1])) ||
        b.containsAll(listOf(a[0][2], a[1][2], a[2][2])) ||
        b.containsAll(listOf(a[0][0], a[1][1], a[2][2])) ||
        b.containsAll(listOf(a[0][2], a[1][1], a[2][0]))
    ) println("Yes")
    else println("No")

}

// Tools
fun readString() = readLine()!!
fun readInt() = readLine()!!.toInt()
fun readLong() = readLine()!!.toLong()
fun readStringList() = readLine()!!.split(" ")
fun readIntList() = readLine()!!.split(" ").map(String::toInt)
fun readLongList() = readLine()!!.split(" ").map(String::toLong)