import Control.Monad

main = do

  a <- replicateM 3 $ map read . words <$> getLine

  n <- readLn

  b <- replicateM n readLn

  putStr $ solve a b

solve :: [[Int]] -> [Int] -> String

solve a' b

  | any eval line = "Yes"

  | otherwise = "No"

  where

    a = concat a'

    line = [0, 4, 8] : [2, 4, 6]

         : [[i .. i+2] | i <- [0, 3, 6]]

        ++ [[i, i+3, i+6] | i <- [0 .. 2]]

    eval = all (flip elem b) . map (a !!)

      