module Main where

import Data.Functor
import Data.List

main :: IO ()
main = do
  { [n] <- getInts
  ; as  <- getInts
  ; putStr . unlines . map (unwords . map show) . insertSorting $ as
  }

insertSorting :: Ord a => [a] -> [[a]]
insertSorting = unfoldr phi . (,) []
  where
    phi z@(xs,[])   = Nothing
    phi z@(xs,y:ys) = Just (zs ++ ys, (zs,ys))
      where zs = insert y xs

getInts :: IO [Int]
getInts = map read . words <$> getLine