fun main(args: Array<String>) {
    val a1 = readLine()!!.split(" ").map { it.toInt() }
    val a2 = readLine()!!.split(" ").map { it.toInt() }
    val a3 = readLine()!!.split(" ").map { it.toInt() }
    val n = readLine()!!.toInt()
    val card = Array(3) { Array(3){ 0 } }
    for (i in 0 until n) {
        val b = readLine()!!.toInt()
        for (j in 0 until 3) {
            when(b) {
                a1[j] -> card[0][j] = 1
                a2[j] -> card[1][j] = 1
                a3[j] -> card[2][j] = 1
            }
        }
    }

    if (card[0][0] + card[0][1] + card[0][2] == 3 || card[1][0] + card[1][1] + card[1][2] == 3 || card[2][0] + card[2][1] + card[2][2] == 3
            || card[0][0] + card[1][0] + card[2][0] == 3 || card[0][1] + card[1][1] + card[2][1] == 3 || card[0][2] + card[1][2] + card[2][2] == 3
            || card[0][0] + card[1][1] + card[2][2] == 3 || card[0][2] + card[1][1] + card[2][0] == 3) {
        println("Yes")
    } else {
        println("No")
    }
}