fun main() {
    var a1 = readLine()!!.split(" ").map { it.toInt() }.toMutableList()
    var a2 = readLine()!!.split(" ").map { it.toInt() }.toMutableList()
    var a3 = readLine()!!.split(" ").map { it.toInt() }.toMutableList()

    for (i in 0 until readLine()!!.toInt()) {
        val num = readLine()!!.toInt()
        when {
            a1.indexOf(num) > -1 -> {
                a1[a1.indexOf(num)] = 0
            }
            a2.indexOf(num) > -1 -> {
                a2[a2.indexOf(num)] = 0
            }
            a3.indexOf(num) > -1 -> {
                a3[a3.indexOf(num)] = 0
            }
        }
    }

//    縦横であっているのかを調べる
    when {
        a1.all { it == 0 } or a2.all { it == 0 } or a3.all { it == 0 } -> {
            println("Yes")
        }
        (a1[0] == 0) and (a2[0] == 0) and (a3[0] == 0) -> {
            println("Yes")
        }
        (a1[1] == 0) and (a2[1] == 0) and (a3[1] == 0) -> {
            println("Yes")
        }
        (a1[2] == 0) and (a2[2] == 0) and (a3[2] == 0) -> {
            println("Yes")
        }
        (a1[0] == 0) and (a2[1] == 0) and (a3[2] == 0) -> {
            println("Yes")
        }
        (a1[2] == 0) and (a2[1] == 0) and (a3[0] == 0) -> {
            println("Yes")
        }
        else -> {
            println("No")
        }
    }

}
