import Data.List

putListLn :: Show a => [a] -> IO ()
putListLn = putStrLn . unwords . map show
getList :: Read a => IO [a]
getList = fmap (map read . words) getLine

isortStates :: Ord a => [a] -> [[a]]
isortStates l = tail $ zipWith (++) (scanl (flip insert) [] l) (tails l)

main :: IO ()
main = do
  _ <- getLine
  ns <- getList :: IO [Int]
  mapM_ putListLn $ isortStates ns