main :: IO()
main = do
    _ <- getLine
    line <- getLine
    let list = split ' ' line
    let reverseList = reverse list
    putWithSpase reverseList
    
putWithSpase ::  [String] -> IO()
putWithSpase (x:[]) = putStrLn  x
putWithSpase (x:xs) = putStr ( x ++ " ") >> putWithSpase xs

split d = _split d []
_split d cs "" = cs
_split d cs s = _split d (cs ++ [token d s]) (drop (length(token d s) + 1) s)
 
token d = _token d ""
_token d t "" = t
_token d t (x:xs) = if (x == d) then t else _token d (t ++ [x]) xs

