-- | Main entry point to the application.
module Main where

import Control.Applicative
import Control.Monad
import Data.List
import Debug.Trace
import Text.Printf

rInt :: String -> Int
rInt str = read str :: Int

solve lst = scanl iter lst [0..length lst - 1]

iter lst n =
    insertMiddle x pre ++ post
    where (pre, x:post) = splitAt n lst
    
insertMiddle x ts =
    pre ++ (x:post)
    where (pre,post) = span (< x) ts

-- | The main entry point.
main :: IO ()
main = do
    _ <- getLine
    lst <- (map rInt . words) <$> getLine
    mapM_ (putStrLn . unwords . map show) $ drop 1 $ solve lst