import Control.Applicative

main :: IO ()
main = do
    getLine
    nums <- map (\n -> read n ::Int) . words <$> getLine
    loop nums []
  where
      loop :: [Int] -> [Int] -> IO ()
      loop [] _          = return ()
      loop (x:xs) sorted = do
          let sn = insertion x sorted
          printNums $ sn ++ xs
          loop xs sn
      printNums :: Show a => [a] -> IO ()
      printNums = putStrLn . unwords . map show

insertion :: Int -> [Int] -> [Int]
insertion v []     = [v]
insertion v (x:xs)
  | x < v     = x:(insertion v xs)
  | otherwise = v:x:xs

