import Control.Monad
import Data.List

solve :: [Bool] -> String
solve [_] = "No"
solve (a11:a12:a13:a21:a22:a23:a31:a32:a33:aa) | all (==True) [a11,a12,a13] = "Yes"
                                               | all (==True) [a21,a22,a23] = "Yes"
                                               | all (==True) [a31,a32,a33] = "Yes"
                                               | all (==True) [a11,a21,a31] = "Yes"
                                               | all (==True) [a12,a22,a32] = "Yes"
                                               | all (==True) [a13,a23,a33] = "Yes"
                                               | all (==True) [a11,a22,a33] = "Yes"
                                               | all (==True) [a13,a22,a31] = "Yes"
                                               | otherwise = "No"

main = do
    aij <- replicateM 3 (map read . words <$> getLine) :: IO [[Int]]
    n <- readLn :: IO Int
    bn <- map read <$> replicateM n getLine :: IO [Int]
    putStrLn $ solve $ map (\x -> elem x bn) $ concat aij
