import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val a1 = sc.nextLine().split(" ").map { it.toInt() }
    val a2 = sc.nextLine().split(" ").map { it.toInt() }
    val a3 = sc.nextLine().split(" ").map { it.toInt() }

    val n = sc.nextInt()

    val b = mutableListOf<Int>()
    for(i in 0 until n){
        b.add(sc.nextInt())
    }

    val c = listOf<List<Int>>(
        a1,
        a2,
        a3,
        listOf(a1[0], a2[0], a3[0]),
        listOf(a1[1], a2[1], a3[1]),
        listOf(a1[2], a2[2], a3[2]),
        listOf(a1[0], a2[1], a3[2]),
        listOf(a1[2], a2[1], a3[0])
    )

    for( c_ in c){
        if(b.containsAll(c_)){
            println("Yes")
            return
        }
    }

    println("No")

}


