data class Bingo (
    val value:Int,
    var isOn:Boolean
)
fun main (args:Array<String>) {
    var bingoList :MutableList<Bingo> = arrayListOf()
    readLine()!!.split(" ").map(String::toInt).forEach{

        bingoList.add(Bingo(it,false))
    }
    readLine()!!.split(" ").map(String::toInt).forEach{

        bingoList.add(Bingo(it,false))
    }
    readLine()!!.split(" ").map(String::toInt).forEach{

        bingoList.add(Bingo(it,false))
    }
//    val list1 = readLine()!!.split(" ").map(String::toInt)
//    val list2 = readLine()!!.split(" ").map(String::toInt)
//    val list3 = readLine()!!.split(" ").map(String::toInt)
    val num = readLine()!!.toInt()

    for (i in 1..num){

        val b = readLine()!!.toInt()
        bingoList.forEach{
            if(it.value == b){
                it.isOn = true
            }
        }
    }
    for(i in 0..6 step 3){
        if(bingoList[i].isOn == true && bingoList[i+1].isOn == true && bingoList[i+2].isOn == true){
            print("Yes")
            return
        }

    }
    for(i in 0..2){
        if(bingoList[i].isOn == true && bingoList[i+3].isOn == true && bingoList[i+6].isOn == true){
            print("Yes")
            return
        }

    }
    for(i in 0..2){
        if(bingoList[i].isOn == true && bingoList[i+3].isOn == true && bingoList[i+6].isOn == true){
            print("Yes")
            return
        }

    }
    if(bingoList[0].isOn == true && bingoList[4].isOn == true && bingoList[8].isOn == true){
        print("Yes")
        return
    }
    if(bingoList[2].isOn == true && bingoList[4].isOn == true && bingoList[6].isOn == true){
        print("Yes")
        return
    }
    print("No")

}