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
    | map fst ops == [1..n] = Just $ map snd ops
    | otherwise = Nothing
  where
    ops = L.sort
        . map (\(y:ys) -> (y + length (dropWhile (y<) ys), y))
        . init
        $ L.tails xs
