import Control.Monad

main = do
   a <- words <$> getLine
   aa <- words <$> getLine
   aaa <- words <$> getLine
   n <- read <$> getLine
   b <- replicateM n getLine
   let c = map (\x -> if elem x b then "0" else x) a
   let cc = map (\x -> if elem x b then "0" else x) aa
   let ccc = map (\x -> if elem x b then "0" else x) aaa
   let zeros = ["0","0","0"]
   if zeros == c || zeros == cc || zeros == ccc || zeros == [c !! 1,cc !! 1,ccc !! 1] || zeros == [c !! 2,cc !! 2,ccc !! 2] || zeros == [c !! 0,cc !! 0,ccc !! 0] || zeros == [c !! 0,cc !! 1, ccc !! 2] || zeros == [c !! 2,cc !! 1,ccc !! 0]
      then putStrLn "Yes"
      else putStrLn "No"