module Main where

import Data.List
import Control.Monad
import Debug.Trace
import qualified Data.ByteString.Char8 as BC
import Data.Maybe (fromJust)
import qualified Data.Set  as S


readTuple2 :: IO (Int, Int)
readTuple2 = do
    [a, b] <- map (fst . fromJust . BC.readInt) . BC.words <$> BC.getLine
    return (a, b)

readTuple3 :: IO (Int, Int, Int)
readTuple3 = do
    [a, b, c] <- map (fst . fromJust . BC.readInt) . BC.words <$> BC.getLine
    return (a, b, c)

readInt :: IO Int
readInt = fst . fromJust . BC.readInt <$> BC.getLine

readInts :: IO [Int]
readInts = map (fst . fromJust . BC.readInt) . BC.words <$> BC.getLine

split :: (a -> Bool) -> [a] -> [[a]]
split f [] = []
split f as = let
    (fo, la) = span f as
    las = case la of
        [] -> []
        xs -> split f $ tail xs
    in
        case fo of
            [] -> las
            xs -> xs : las

solve (a1,a2,a3) (b1,b2,b3) (c1,c2,c3) bingos = 
    let
        bingo = S.fromList bingos
    in
    if a1 `S.member` bingo && a2  `S.member` bingo && a3 `S.member` bingo then "Yes"
    else if b1 `S.member` bingo && b2  `S.member` bingo && b3 `S.member` bingo then "Yes"
    else if c1 `S.member` bingo && c2  `S.member` bingo && c3 `S.member` bingo then "Yes"
    else if a1 `S.member` bingo && b1  `S.member` bingo && c1 `S.member` bingo then "Yes"
    else if a2 `S.member` bingo && b2  `S.member` bingo && c2 `S.member` bingo then "Yes"
    else if a3 `S.member` bingo && b3  `S.member` bingo && c3 `S.member` bingo then "Yes"
    else if a1 `S.member` bingo && b2  `S.member` bingo && c3 `S.member` bingo then "Yes"
    else if c1 `S.member` bingo && b2  `S.member` bingo && a3 `S.member` bingo then "Yes"
        else "No"



main = do
    a <- readTuple3
    b <- readTuple3
    c <- readTuple3
    num <- readInt
    bingos <- replicateM num readInt
    putStrLn $ solve a b c bingos
