import qualified Data.Text as T
import qualified Data.Text.IO as T
import qualified Data.Text.Read as T
import Data.List (transpose)

main :: IO ()
main = do
  ass <- sequence . replicate 3 $ map unsafeTextToInt . T.words <$> T.getLine :: IO [[Int]]
  n <- unsafeTextToInt <$> T.getLine :: IO Int
  bs <- sequence . replicate n $ unsafeTextToInt <$> T.getLine :: IO [Int]
  let
    rs = ass
    cs = transpose ass
    ds = [map (\i -> ass !! i !! i) [0..2], map (\i -> ass !! (2 - i) !! i) [0..2]]
  putStrLn $ if (any null . map (\\ bs) $ rs ++ cs ++ ds) then "Yes" else "No"

unsafeTextToInt :: T.Text -> Int
unsafeTextToInt s = case T.signed T.decimal s of
  Right (n, _) -> n
