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

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

main = do
  a1 <- getIntList
  a2 <- getIntList
  a3 <- getIntList
  n <- getInt
  bs <- replicateM n getInt

  let a4 = [a1 !! 0, a2 !! 0, a3 !!0]
      a5 = [a1 !! 1, a2 !! 1, a3 !!1]
      a6 = [a1 !! 2, a2 !! 2, a3 !!2]
      a7 = [a1 !! 0, a2 !! 1, a3 !!2]
      a8 = [a1 !! 2, a2 !! 1, a3 !!0]

  putStrLn $ check [a1, a2, a3, a4, a5, a6, a7, a8] bs

  where
    check [] _ = "No"
    check (a:as) bs = let c0 = (a!!0) `elem` bs
                          c1 = (a!!1) `elem` bs
                          c2 = (a!!2) `elem` bs
                      in
                        if c0 && c1 && c2
                        then "Yes"
                        else check as bs