import java.util.*

fun main(args: Array<String>) {
    val b = Array(3) { IntArray(3) { 0 } }
    val check = Array(3) { Array(3) { false } }
    for (i in 0 until 3) {
        b[i] = readLine()!!.split(' ').map { it.toInt() }.toIntArray()
    }
    val N = readLine()!!.toInt()
    for (i in 0 until N) {
        val x = readLine()!!.toInt()
        for (j in 0 until 3) {
            for (k in 0 until 3) {
                if (b[j][k] == x) {
                    check[j][k] = true
                }
            }
        }
    }
    val ok = (check[0][0] && check[0][1] && check[0][2])
            || (check[1][0] && check[1][1] && check[1][2])
            || (check[2][0] && check[2][1] && check[2][2])
            || (check[0][0] && check[1][0] && check[2][0])
            || (check[0][1] && check[1][1] && check[2][1])
            || (check[0][2] && check[1][2] && check[2][2])
            || (check[0][0] && check[1][1] && check[2][2])
            || (check[0][2] && check[1][1] && check[2][0])
    println(if (ok) "Yes" else "No")
}