module Main where
import Debug.Trace
import Data.List
import Data.Char
import Data.Array
import Data.Maybe
import Data.Ord
import Control.Monad

solve :: [Int] -> [[Int]]
solve l = iter 0 [] (l) where
    iter c sl [] = [sl, [c]]
    iter c sl l = iter2 c [] l where
        iter2 c ac [x] = iter c (x:sl) (reverse ac)
        iter2 c ac (x:y:ds)
            | x <= y     = iter2 (c) (x:ac) (y:ds)
            | otherwise = iter2 (c+1) (y:ac) (x:ds)

readLine:: IO [Int]
readLine = fmap (map read . words) getLine

main :: IO() 
main = do
    n <- readLn :: IO Int
    l <- readLine
    mapM_ putStrLn $ map (\y -> init (concatMap (\x-> show x ++ " ") y)) (solve l)

