import Control.Monad

main :: IO()
main = do
    a <- replicateM 3 $ map read . words <$> getLine
    n <- readLn
    b <- replicateM n readLn
    putStrLn $ if solve a b then "Yes" else "No"

solve :: [[Int]] -> [Int] -> Bool
solve a b = foldr (||) False bs
    where bs = map ts grid
          ts = toBoolRow (exist a b)

grid :: [[(Int, Int)]]
grid = [[(0, 0), (0, 1), (0, 2)], [(1, 0), (1, 1), (1, 2)], [(2, 0), (2, 1), (2, 2)]
       ,[(0, 0), (1, 0), (2, 0)], [(0, 1), (1, 1), (2, 1)], [(0, 2), (1, 2), (2, 2)]
       ,[(0, 0), (1, 1), (2, 2)], [(0, 2), (1, 1), (2, 0)]]

toBoolRow ::[[Bool]] -> [(Int, Int)] -> Bool
toBoolRow bs [] = True
toBoolRow bs ((a, b):xs) = bs !! a !! b && toBoolRow bs xs

exist :: [[Int]] -> [Int] -> [[Bool]]
exist a b = map (map (\x -> elem x b)) a