-- Question C

import Control.Applicative
import Control.Monad

main = do
  n <- readLn ::IO Int
  zs <- (map read . words) <$> getLine 
  putStr $ unwords ( map show ( try' 1 n [] zs) )
  
try' :: Int -> Int -> [Int] -> [Int] -> [Int]
try' i k ys xs  
  | i == k+1　= ys
  | otherwise = try' (i+1) k (reverse (ys ++ [xs !! (i-1)] ) ) xs
