type Seq = [Int]

insertionSortVerbose    :: Seq -> [Seq]
insertionSortVerbose xs = tail $ scanl step xs [0..length xs-1]

step      :: Seq -> Int -> Seq
step es n = let (pre,x:post) = splitAt n es in insertOrderd x pre ++ post
 
insertOrderd      :: Int -> Seq -> Seq
insertOrderd x ts = let (pre,post) = span (< x) ts in pre ++ (x:post)
 
main :: IO () 
main = getContents >>= mapM_ putStrLn.map (unwords.map show).insertionSortVerbose.map read.words.last.lines