gets
s = gets

a = s.split.map {|x| x.to_i}


mind=999
mini=-1

r = []
while a.size > 0
  a.size.times { |i|
    v = a[i]
    d = i-v+1

    if d < 0
      puts "-1"
      exit
    end
    if d <= mind
      mind = d
      mini = i
    end
  }
  
  r << a[mini]
  a.delete_at(mini)
end

r.reverse.each {|u|
  puts u
}