main = do
  _ <- getLine
  bs <- map read . words <$> getLine
  mapM_ print $ f bs []

maxIns :: [Int] -> Int
maxIns bs = fst .last . filter ((==) <$> fst <*> snd) $ zip bs [1..]

rm :: [Int] -> Int -> [Int]
rm bs i = take (i-1) bs ++ drop i bs

f :: [Int] -> [Int] -> [Int]
f [] as = as
f bs as = let i = maxIns bs in f (rm bs i) (i:as)