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

readInt = fst . fromJust . BS.readInt
readIntList = map readInt . BS.words
getInt = readInt <$> BS.getLine
getIntList = readIntList <$> BS.getLine

main = do
    as <- concat <$> replicateM 3 getIntList
    n <- getInt
    bs <- replicateM n getInt
    let ans = [elem a bs| a <- as]
    putStrLn $ check ans

check [a1, a2, a3, a4, a5, a6, a7, a8, a9]
    | and [a1, a2, a3] = "Yes"
    | and [a4, a5, a6] = "Yes"
    | and [a7, a8, a9] = "Yes"
    | and [a1, a4, a7] = "Yes"
    | and [a2, a5, a8] = "Yes"
    | and [a3, a6, a9] = "Yes"
    | and [a1, a5, a9] = "Yes"
    | and [a3, a5, a7] = "Yes"
    |otherwise = "No"