module Main where
import qualified Control.Monad as C
import qualified Data.Char as C
import qualified Data.List as L
import qualified Data.Map as M
import qualified Data.Array as A

int = read :: String -> Int
getWord :: IO String
getWord = do
  c <- getChar
  if C.isSpace c
  then
    return []
  else do
    ws <- getWord
    return (c:ws)
getInt = fmap int getWord
replace pred a = map (\x -> if pred x then a else x)

main = interact $ printer . solver . parser
parser = map int . words
printer = unlines . (:[]) 

solver (a11:a12:a13:a21:a22:a23:a31:a32:a33:n:bs) = 
  if elem a11 bs && elem a12 bs && elem a13 bs 
  || elem a21 bs && elem a22 bs && elem a23 bs
  || elem a31 bs && elem a32 bs && elem a33 bs
  || elem a11 bs && elem a21 bs && elem a31 bs
  || elem a12 bs && elem a22 bs && elem a32 bs
  || elem a13 bs && elem a23 bs && elem a33 bs
  || elem a11 bs && elem a22 bs && elem a33 bs
  || elem a13 bs && elem a22 bs && elem a31 bs
  then "Yes"
  else "No"


