import qualified Data.List as L

main :: IO ()
main = do
    n <- readLn :: IO Int
    xs <- map read.words <$> getLine
    case solve n xs of
        Just ys -> putStr.unlines $ map show ys
        Nothing -> print (-1)

solve :: Int -> [Int] -> Maybe [Int]
solve n xs = go [] xs
  where
    go acc [] = Just acc
    go acc xs = case L.partition (uncurry (==)) $ zip [1..] xs of
        ([], _) -> Nothing
        (ys, zs) -> go (y:acc) $ L.delete y xs
          where
            (y, _) = last ys