import Data.List                                                                                                                                      
import Data.Maybe                                                                                                                                     
main :: IO ()                                                                                                                                         
main = do                                                                                                                                             
  getLine                                                                                                                                             
  bs <- map read . words <$> getLine                                                                                                                  
  putStrLn $ case solve [(bs,[])] of                                                                                                                  
    Nothing -> "-1"                                                                                                                                   
    Just x -> init $ unlines $ map show x                                                                                                             
                                                                                                                                                      
                                                                                                                                                      
solve :: [([Int],[Int])] -> Maybe [Int]                                                                                                               
solve [] = Nothing                                                                                                                                    
solve (([],ps):_) = Just ps                                                                                                                           
solve ((xs,ps):xss) =                                                                                                                                 
  let check = filter (\(x,y) -> x==y) $ zip xs [1..] :: [(Int,Int)]                                                                                   
  in if null check                                                                                                                                    
     then solve xss                                                                                                                                   
     else solve $ zip (map (map fst . (\x -> delete x (zip xs [1..]))) check) (map ((:ps).fst) check) ++ xss