main = do
    [a, b, c] <- words <$> getLine
    if head (reverse a) == head b then
        if head (reverse b) == head c then
            putStrLn "YES"
        else
            putStrLn "NO"
    else
        putStrLn "NO"
