import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val a = (1..3).map {
        (1..3).map { sc.nextInt() }
    }
    val n = sc.nextInt()
    val b = (1..n).map {
        sc.nextInt()
    }

    println(abc157b(a, b))
}

private fun abc157b(a: List<List<Int>>, b: List<Int>): String {
    val bingo = mutableListOf<Boolean>()    
    for (i in 0..2) {
        for (j in 0..2) {
            if (b.contains(a.get(i).get(j))) {
                bingo.add(true)
            } else {
                bingo.add(false)
            }
        }
    }

    var hit = false
    if (bingo.get(0)) {
        if (bingo.get(1) && bingo.get(2)) hit = true
        if (bingo.get(3) && bingo.get(6)) hit = true
    }
    if (bingo.get(4)) {
        if (bingo.get(0) && bingo.get(8)) hit = true
        if (bingo.get(1) && bingo.get(7)) hit = true
        if (bingo.get(2) && bingo.get(6)) hit = true
        if (bingo.get(3) && bingo.get(5)) hit = true
    }
    if (bingo.get(8)) {
        if (bingo.get(2) && bingo.get(5)) hit = true
        if (bingo.get(6) && bingo.get(7)) hit = true
    }
    var ans = "No"
    if (hit) ans = "Yes"

    return ans
}