main = do
  n <- getLine >>= return . (read :: String -> Int)
  xs <- getLine >>= return . map (read :: String -> Int) . words
  insSort xs 1

printXs xs = putStrLn $ unwords $ map show xs

insSort xs n | n == length xs = printXs xs >> return ()
insSort xs n = do
  printXs xs
  let ys = insSort1 xs n
  insSort ys (n+1)

insSort1 :: [Int] -> Int -> [Int]
insSort1 xs n =
  insert (take n xs) (xs !! n) ++ (drop (n+1) xs)

insert :: [Int] -> Int -> [Int]
insert xs z =
  aux xs [] z
    where
      aux []   ys z = ys ++ [z]
      aux (x:xs) ys z = if z < x then ys ++ [z] ++ x:xs
                                 else aux xs (ys++[x]) z