import           Control.Monad
import           Control.Monad.ST
import qualified Data.Array                    as A
import qualified Data.Array.Unboxed            as AU
import qualified Data.Array.ST                 as ST
import qualified Data.ByteString.Char8         as BS
import           Data.Char
import           Data.Int
import qualified Data.IntMap                   as IM
import           Data.List
import qualified Data.Map                      as M
import           Data.Maybe
import           Data.Ord
import qualified Data.Set                      as S
import           Data.Time
import qualified Data.Vector                   as V
import qualified Data.Vector.Mutable           as VM
import qualified Data.Vector.Unboxed           as VU
import qualified Data.Vector.Unboxed.Mutable   as VUM

readInt = map (fst . fromJust . BS.readInt) . BS.words <$> BS.getLine
readInts n = replicateM n readInt
readString = map BS.unpack . BS.words <$> BS.getLine
readStrings n = replicateM n $ BS.unpack <$> BS.getLine
toPair [x, y] = (x, y)

main = do
  a   <- readInts 3
  [n] <- readInt
  b   <- concat <$> readInts n
  putStrLn $ solve a b

solve :: [[Int]] -> [Int] -> String
solve a b | ans       = "Yes"
          | otherwise = "No"
 where
  a' = map (map (\x -> x `elem` b)) a
  ans =
    True
      `elem` ( all (== True) [a' !! 0 !! 0, a' !! 0 !! 1, a' !! 0 !! 2]
             : all (== True) [a' !! 1 !! 0, a' !! 1 !! 1, a' !! 1 !! 2]
             : all (== True) [a' !! 2 !! 0, a' !! 2 !! 1, a' !! 2 !! 2]
             : all (== True) [a' !! 0 !! 0, a' !! 1 !! 0, a' !! 2 !! 0]
             : all (== True) [a' !! 0 !! 1, a' !! 1 !! 1, a' !! 2 !! 1]
             : all (== True) [a' !! 0 !! 2, a' !! 1 !! 2, a' !! 2 !! 2]
             : all (== True) [a' !! 0 !! 0, a' !! 1 !! 1, a' !! 2 !! 2]
             : all (== True) [a' !! 0 !! 2, a' !! 1 !! 1, a' !! 2 !! 0]
             : []
             )

