import java.util.*

fun main(args: Array<String>) {
    val scn = Scanner(System.`in`)
    var A = Array(4, {IntArray(4)})
    for(i in 1..3){
        for(j in 1..3) {
            A[i][j] = scn.nextInt()
        }
    }

    val N = scn.nextInt()
    var b = IntArray(N+1)
    for(i in 1..N){
        b[i] = scn.nextInt()
    }

    for(i in 1..3){
        for(j in 1..3) {
            for(k in 1..N){
                if(A[i][j] == b[k]) A[i][j] = 0
            }
        }
    }

    var result = false
    // 横
    for(i in 1..3){
        if(isBingo(A[i][1], A[i][2], A[i][3])) result = true
    }

    // 縦
    for(j in 1..3){
        if(isBingo(A[1][j], A[2][j], A[3][j])) result = true
    }

    // 斜め
    if(isBingo(A[1][1], A[2][2], A[3][3])) result = true
    if(isBingo(A[1][3], A[2][2], A[3][1])) result = true

    if(result) {
        println("Yes")
    }else{
        println("No")
    }
}

fun isBingo(i:Int,j:Int,k:Int): Boolean {
    if(i==0 && j ==0 && k ==0) return true
    return false
}
