import java.util.*

fun main(args: Array<String>) {
   val sc = Scanner(System.`in`)

   var bingo = IntArray(9)
   var bingoOpen = BooleanArray(9)

   for(i in 0 until 9){
       bingo[i] = sc.nextInt()
      bingoOpen[i] = false
   }

   val n = sc.nextInt()
   val nums = IntArray(n)
   for(i in 0 until n) {
      nums[i] = sc.nextInt()
      val index = bingo.indexOf(nums[i])
      if(index >= 0){
         bingoOpen[index] = true
      }
   }

   val ans = bingoOpen[0] && bingoOpen[1] && bingoOpen[2] ||
   bingoOpen[3] && bingoOpen[4] && bingoOpen[5] ||
           bingoOpen[6] && bingoOpen[7] && bingoOpen[8] ||
           bingoOpen[0] && bingoOpen[3] && bingoOpen[6] ||
           bingoOpen[1] && bingoOpen[4] && bingoOpen[7] ||
           bingoOpen[2] && bingoOpen[5] && bingoOpen[8] ||
           bingoOpen[0] && bingoOpen[4] && bingoOpen[8] ||
           bingoOpen[2] && bingoOpen[4] && bingoOpen[6]

   println(if(ans) "Yes" else "No")







}