import Control.Monad
import Data.List
    
readInt :: String -> Int
readInt = read

hale_punching :: Maybe Int -> [Int] -> [Int]
hale_punching (Just z) xs = take z xs ++ [0] ++ drop (z+1) xs
hale_punching Nothing xs = xs
                       
check_card:: [Int] -> [Int] -> [Int]
check_card xs [] = xs
check_card xs (y:ys) = check_card (hale_punching z xs) ys
    where
      z = elemIndex y xs

check_bingo :: [Int] -> Bool
check_bingo xs
            |sum xs == 0 = True
            |otherwise = False
                         
check_result :: [Int] -> String
check_result xs
             | result == True = "Yes"
             | otherwise = "No"
                     where          
                       cl1 = check_bingo [xs !! 0 ,xs !! 1 , xs !! 2]
                       cl2 = check_bingo [xs !! 3 , xs !! 4 , xs !! 5]
                       cl3 = check_bingo [xs !! 6 , xs !! 7 , xs !! 8]
                       rw1 = check_bingo [xs !! 0 , xs !! 3 , xs !! 6]
                       rw2 = check_bingo [xs !! 1 , xs !! 4 , xs !! 7]
                       rw3 = check_bingo [xs !! 2 , xs !! 5 , xs !! 8]
                       cr1 = check_bingo [xs !! 0 , xs !! 4 , xs !! 8]
                       cr2 = check_bingo [xs !! 2 , xs !! 4 , xs !! 6]
                       result = cl1 || cl2 || cl3 || rw1 || rw2 || rw3 || cr1 || cr2  

bingo :: [Int] -> [Int] -> String
bingo xs ys = check_result (check_card xs ys)
    
main :: IO ()
main  = do
  a1 <- (map readInt . words) <$> getLine
  a2 <- (map readInt . words) <$> getLine
  a3 <- (map readInt . words) <$> getLine
  n  <- readInt <$> getLine
  b  <- replicateM n $ readInt <$> getLine
  let a = a1 ++ a2 ++ a3
  putStrLn $bingo a b