import Data.List
import Control.Monad

main = do
 [[a11,a12,a13],[a21,a22,a23],[a31,a32,a33]] <- replicateM 3 (map read . words <$> getLine :: IO[Int])
 let a1 = sort [a11,a12,a13]
 let a2 = sort [a21,a22,a23]
 let a3 = sort [a31,a32,a33]
 let a4 = sort [a11,a21,a31]
 let a5 = sort [a12,a22,a32]
 let a6 = sort [a13,a22,a33]
 let a7 = sort [a11,a22,a33]
 let a8 = sort [a13,a22,a31]
 num <- read <$> getLine :: IO Int
 b <- sort <$> replicateM num (read <$> getLine :: IO Int)
 putStrLn $ if((isSubsequenceOf a1 b) || (isSubsequenceOf a2 b) || (isSubsequenceOf a3 b) || (isSubsequenceOf a4 b) || (isSubsequenceOf a5 b) || (isSubsequenceOf a6 b) || (isSubsequenceOf a7 b) || (isSubsequenceOf a8 b)) then "Yes" else "No"