import qualified Data.Map as MP
import Data.Char
import Data.List
import Control.Monad
import Debug.Trace

step :: MP.Map Int Bool -> Int -> MP.Map Int Bool
step m i = 
    case MP.lookup i m of
        Just _ -> MP.adjust (||True) i m
        Nothing -> m

step' :: Bool -> (Int, Int, Int) -> MP.Map Int Bool -> Bool
step' j (a,b,c) m =
    let
        Just x = MP.lookup a m
        Just y = MP.lookup b m
        Just z = MP.lookup c m
    in
        j || (and [x,y,z])

main = do
    [a,b,c] <- map read . words <$> getLine :: IO [Int]
    [d,e,f] <- map read . words <$> getLine :: IO [Int]
    [g,h,i] <- map read . words <$> getLine  :: IO [Int]
    n <- readLn :: IO Int
    xs <- replicateM n readLn :: IO [Int]
    let m = foldl' (\m k -> MP.insert k False m) MP.empty [a,b,c,d,e,f,g,h,i]
    let m' = foldl' step m xs
    let res = foldl' (\b x -> step' b x m') False [(a,b,c), (d,e,f), (g,h,i), (a,d,g), (b,e,h), (c,f,i), (a,e,i), (c,e,g)]
    putStrLn $ if res then "Yes" else "No"