import java.util.*

private val scanner = Scanner(System.`in`)
private fun readAtOnce(): List<String> = readLine()!!.split(" ")
private fun readInts(): List<Int> = readAtOnce().map(String::toInt)
private fun readLongs(): List<Long> = readAtOnce().map(String::toLong)
private fun zeroArray(size: Int): IntArray = IntArray(size) { 0 }
private fun Int.repeat(predicate: (Int) -> Unit) = repeat(this, predicate)

fun main(array: Array<out String>) {
    val A = Array(9) { scanner.nextInt() }
    val bingo = Array(9) { false }
    val N = scanner.nextInt()
    (0 until N)
            .map { A.indexOf(scanner.nextInt()) }
            .filter { it != -1 }
            .forEach { bingo[it] = true }

    val vertical = setOf(0, 1, 2).any { bingo[it] && bingo[it + 3] && bingo[it + 6] }
    val horizontal = setOf(0, 3, 6).any { bingo[it] && bingo[it + 1] && bingo[it + 2] }
    val diagonal = (bingo[0] && bingo[4] && bingo[8]) || (bingo[2] && bingo[4] && bingo[6])

    println(if (vertical || horizontal || diagonal) "Yes" else "No")
}