
import qualified Data.Vector.Unboxed as U
import qualified Data.Vector as V
import qualified Data.ByteString.Char8 as C
import Debug.Trace
import Data.List
import Control.Monad
import Control.Arrow
import Data.Ord


r :: Int -> IO (U.Vector Int)
r n = U.unfoldrN n (C.readInt . C.dropWhile (==' ')) <$> C.getLine

r' :: IO [Int]
r'  =   unfoldr    (C.readInt . C.dropWhile (==' ')) <$> C.getLine



main :: IO ()
main = do
    as <- replicateM 3 r'
    n <- readLn :: IO Int
    bs <- replicateM n readLn :: IO [Int]
    putStrLn $ if ev (op as bs) then "Yes" else "No"


op :: [[Int]] -> [Int] -> [[Bool]]
op as bs = map (map (\a -> any (a==) bs)) as

ev xs@[ [a,b,c],
        [d,e,f],
        [g,h,i]] = or (map and xs) || and [a,e,i] || and [g,e,c]