import Data.List
import Control.Monad

solve xs acc
  | null xs = acc
  | null zs = []  
  | otherwise = let (_,v) = maximum zs in solve (delete v xs) (v:acc)
  where
    l = length xs
    zs = filter (uncurry (==)) $ zip [1..l] xs
 
main = do 
  n <- readLn :: IO Int
  bs <- map read . words <$> getLine :: IO [Int]
  case solve bs [] of
    [] -> print (-1)
    xs -> mapM_ print xs
