import Control.Applicative
import Data.List
toInt::String->Int
toInt = read
format::[Int]->String
format [x] = show x
format (x:xs) = show x ++ " " ++ format xs
sub2::[Int]->[[Int]]->[String]
sub2 [] [ys] = [format ys]
sub2 xs'@(x:xs) (ys:yss) = (format ys ++ " " ++ format xs') : sub2 xs yss
sub (x:xs) (y:ys) = sub2 xs ys
main::IO ()
main = do
  getLine
  a <- (map toInt).words <$> getLine
  (putStr.unlines.(sub a).(scanl (flip insert) [])) a
