import Control.Monad
import Data.Maybe
import qualified Data.ByteString.Char8 as BS

tuplify2 (x:y:_) = (x,y)
tuplify2 _ = undefined

--Input functions with ByteString
readInt = fst . fromJust . BS.readInteger
readIntTuple = tuplify2 . map readInt . BS.words
readIntList = map readInt . BS.words

getInt = readInt <$> BS.getLine
getIntList = readIntList <$> BS.getLine
getIntNList n = map readIntList <$> replicateM (fromIntegral n) BS.getLine
getIntMatrix = map readIntList . BS.lines <$> BS.getContents
getIntTuple = readIntTuple <$> BS.getLine
getIntNTuples n = map readIntTuple <$> replicateM (fromIntegral n) BS.getLine
getIntTuples = map readIntTuple . BS.lines <$> BS.getContents

main = do
    a <- getIntNList 3
    n <- getInt
    b <- replicateM (fromIntegral n) getInt
    let a1 = foldr (\x acc -> if x `elem` b then acc else False) True (a!!0)
    let a2 = foldr (\x acc -> if x `elem` b then acc else False) True (a!!1)
    let a3 = foldr (\x acc -> if x `elem` b then acc else False) True (a!!2)
    let a4 = foldr (\x acc -> if x `elem` b then acc else False) True ([a!!0!!0, a!!1!!0, a!!2!!0])
    let a5 = foldr (\x acc -> if x `elem` b then acc else False) True ([a!!0!!1, a!!1!!1, a!!2!!1])
    let a6 = foldr (\x acc -> if x `elem` b then acc else False) True ([a!!0!!2, a!!1!!2, a!!2!!2])
    let a7 = foldr (\x acc -> if x `elem` b then acc else False) True ([a!!0!!0, a!!1!!1, a!!2!!2])
    let a8 = foldr (\x acc -> if x `elem` b then acc else False) True ([a!!0!!2, a!!1!!1, a!!2!!0])
    putStrLn $ if a1||a2||a3||a4||a5||a6||a7||a8 then "Yes" else "No"