data class Bingo(val value: Int, var isOn: Boolean)
fun main (args:Array<String>){
    var bingoList: MutableList<Bingo> = arrayListOf()

    bingoList.addAll(readLine()!!.split(" ").map { Bingo(it.toInt(), false) })
    bingoList.addAll(readLine()!!.split(" ").map { Bingo(it.toInt(), false) })
    bingoList.addAll(readLine()!!.split(" ").map { Bingo(it.toInt(), false) })

    val N = readLine()!!.toInt()
    for (i in 1..N) {
        val A = readLine()!!.toInt()
        bingoList.filter { it.value == A }.forEach { it.isOn = true }
    }

    // 横
    for (i in 1..3) {
        val startNo = (i - 1) * 3
        if (bingoList[startNo].isOn && bingoList[startNo + 1].isOn && bingoList[startNo + 2].isOn) {
            print("Yes")
            return;
        }
    }
    // 縦
    for (i in 1..3) {
        val startNo = i - 1
        if (bingoList[startNo].isOn && bingoList[startNo + 3].isOn && bingoList[startNo + 6].isOn) {
            print("Yes")
            return;
        }
    }
    if (bingoList[0].isOn && bingoList[4].isOn && bingoList[8].isOn) {
        print("Yes")
        return;
    }
    if (bingoList[2].isOn && bingoList[4].isOn && bingoList[6].isOn) {
        print("Yes")
        return;
    }
    print("No")
}
