import java.io.BufferedReader
import java.io.InputStreamReader

val reader by lazy { BufferedReader(InputStreamReader(System.`in`)) }

@Suppress("ReplaceJavaStaticMethodWithKotlinAnalog")
fun main(a: Array<String>) {
    val card = (0..2).map { reader.readArgs().map(String::toInt) }
    val checker = (0..2).map { (0..2).map { false }.toMutableList() }
    val n = reader.readInt()
    val numbers = (1..n).map { reader.readInt() }

    (0..2).forEach { i ->
        (0..2).forEach { j ->
            checker[i][j] = numbers.any { it == card[i][j] }
        }
    }
    checker.forEach { list ->
        if (list.none { !it }) {
            println("Yes")
            return
        }
    }
    (0..2).forEach { i ->
        if ((0..2).map { j -> checker[j][i] }.none { !it }) {
            println("Yes")
            return
        }
    }
    if ((0..2).map { checker[it][it] }.none { !it }) {
        println("Yes")
        return
    }
    if (arrayListOf(checker[0][2], checker[1][1], checker[2][0]).none { !it }) {
        println("Yes")
        return
    }
    println("No")
}

fun BufferedReader.readArgs() = readLine().split(" ")
fun BufferedReader.readInt() = readLine().toInt()
fun BufferedReader.readLong() = readLine().toLong()
fun BufferedReader.readChar() = readLine().toInt().toChar()
fun BufferedReader.readString() = readLine().toInt().toString()
