
fun bingo(sheet:List<List<Int>>, n:Int){
    var bingo = (0 until 3).map{IntArray(3)}

    for(i in 0 until n){
        var tmp = readLine()!!.toInt()
        for(y in 0..2){
            for(x in 0..2){
                if(sheet[y][x] == tmp){
                    bingo[y][x] = 1
                }
            }
        }
    }

    check_bingo(bingo)
}

fun check_bingo(bingo:List<IntArray>){
    var ans = "No"
    //horizon
    for(i in 0..2){
        if(bingo[i].sum() == 3){
            ans = "Yes"
        }
    }

    //vertical
    for(x in 0..2)
        if(bingo[0][x] + bingo[1][x] + bingo[2][x] == 3){
            ans = "Yes"
        }

    //cross
    if(bingo[0][0] + bingo[1][1] + bingo[2][2] == 3 || bingo[0][2] + bingo[1][1] + bingo[2][0] == 3){
        ans = "Yes"
    }

    println(ans)
}

fun main(){
    var sheet = (0 until 3).map{readLine()!!.split(' ').map{it.toInt()}}
    val n = readLine()!!.toInt()
    bingo(sheet,n)
}