
import Data.List
import Control.Monad

solver::[Int]->Maybe [Int]
solver [] = Just []
solver ls = let idxed = zip ls [1..]  in
            let l = (filter (\(v,i)->v==i) idxed) in
            if l == [] then Nothing
                       else let (v,erase_id) = maximumBy (\ x -> \ y ->compare (snd x) (snd y)) l in
                            do
                              rest<-solver [ v |(v,i)<-idxed,i/=erase_id]
                              return (v:rest)

main::IO()
main=do
  nc<-getLine
  let n = read nc::Int
  dat<-return.map read.words=<<getLine
  case solver dat of
    Nothing -> print (-1)
    Just ls -> forM_  (reverse ls) (\v->print v)