import Data.Char
import Control.Monad

parseInputLine :: String -> String -> [Int]
parseInputLine val [] = [read val]
parseInputLine val (' ':xs) = [read val] ++ parseInputLine "" xs
parseInputLine val (x:xs) = parseInputLine (val ++ [x]) xs

isBingo :: Int -> Int -> [Int] -> Bool
isBingo base step xs = v1 == 0 && v2 == 0 && v3 == 0
  where i1 = base
        i2 = base + step
        i3 = base + step*2
        v1 = xs!!i1
        v2 = xs!!i2
        v3 = xs!!i3

params = [
           (0, 3)
         , (1, 3)
         , (2, 3)
         , (0, 1)
         , (3, 1)
         , (6, 1)
         , (0, 4)
         , (2, 2)
         ]

check :: [Int] -> Bool
check xs = or [isBingo base step xs | (base, step) <- params]

bingoCard :: [Int] -> [Int] -> [Int]
bingoCard card bs = [if c `elem` bs then 0 else c | c <- card]

solve :: [Int] -> [Int] -> String
solve card bs = if check bc
                   then "Yes"
                   else "No"
                     where bc = bingoCard card bs

main :: IO ()
main = do
  line1 <- getLine
  line2 <- getLine
  line3 <- getLine
  n <- getLine
  bs <- replicateM (read n) getLine
  let card = (parseInputLine "" line1) ++ (parseInputLine "" line2) ++ (parseInputLine "" line3)
      output = solve card (map (read) bs)
  putStrLn output
