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

main :: IO ()
main = do
  n <- getLine
  a <- map read . words <$> getLine
  putStr $ unlines $ map (unwords . map show) $ insertSort [] a []
    where
      insertSort::[Int]->[Int]->[[Int]]->[[Int]]
      insertSort _ [] steps = steps
      insertSort sorted (x:xs) steps = insertSort inserted xs (steps ++ [inserted ++ xs])
        where
          insert [] = [x]
          insert (y:ys)
            | x < y = x : y : ys
            | otherwise = y : insert ys
          inserted = insert sorted
