{-# LANGUAGE ScopedTypeVariables #-}
import qualified Data.Array as A
import Control.Monad
import qualified Data.Set as Set

readInput :: Read a => IO [a]
readInput = map read . words <$> getLine

main = do
    table :: A.Array (Int,Int) Int <- A.listArray ((0,0),(2,2)) . concat <$> replicateM 3 readInput
    n <- readLn
    marks <- Set.fromList <$> replicateM n readLn
    putStrLn $ case or [and [Set.member (table A.! (c, r)) marks | c <- [0..2]] | r <- [0..2]]
      || or [and [Set.member (table A.! (c, r)) marks | r <- [0..2]] | c <- [0..2]]
      || and [Set.member (table A.! (c, c)) marks | c <- [0..2]]
      || and [Set.member (table A.! (c, 2 - c)) marks | c <- [0..2]] of
          False -> "No"
          True -> "Yes"