N,*A = `dd`.split.map &:to_i

ns = (1..N).map{ [] }
A.each{ |a|
  (1..N).each{ |i|
    ns[i-1] << ((a == i) ? i : 0)
  }
}

op = []

(1..N).reverse_each{ |i|
  (1..i).reverse_each{ |a|
    if ns[a-1][a-1] == a
      op << a
      (1..N).each{ |j|
        ns[j-1].delete_at(a-1)
      }
      break
    end
  }
  if op.size < N-i+1
    p -1; exit
  end
}
puts op.reverse