def candi(n)
  x = Array.new
  for i in 2..n do
    x << (1..i).to_a
  end
  [1].product(*x).collect {|set| set}
end
# p candi(3)

def procedure(r)
  a = []
  r.each do |s|
    a.insert(s-1,s)  
  end
  a
end
#t = [1,1,2]
#p procedure(t)
def solved(r)
  ok = true
  for i in 0..(r.size-1) do
    if r[i] > i+1 then
      ok = false
    end
  end
  ok
end
# p solved([2,2])
# p solved([1,2])

x = Array.new
y = Array.new
while line = gets do
  x += line.chomp.split
end
x.each do |t|
  y << t.to_i
end
big_n = y[0]
b = y[1..-1]
# p big_n
# p b
if solved(b) then
  candi(big_n).each do |r|
    if procedure(r) == b then
      # puts r.join(" ")
      r.each {|s| puts s}
    end
  end
else
  puts "-1"
end
