import Control.Applicative
import Control.Monad
import Data.List

isort :: [Int] -> ( [Int], [[Int]])
isort [x] = ( [x], [[x]] )
isort (x:xs) = (x',logging ++ [reverse x'])
               where (sorted,logging) = isort xs
                     x' = filter(> x) sorted ++ [x] ++ filter(<= x) sorted

complete y x = x ++ drop (length x) y


main = do 
    x <- (map read.words) <$> getLine
    let (_,logging) = isort.reverse $ x 
    let a = intercalate "\n" $ map (unwords.map show.complete x) logging
    putStrLn $ a