input = []
while (n = gets.to_i) != 0 do
  input = gets.split.map(&:to_i)
end

puts input*" "
for i in 1..input.size - 1 do
  v = input[i]
  j = i - 1
  while j >= 0 && input[j] > v do
    input[j+1] = input[j]
    j -= 1
    input[j+1] = v
  end
  puts input*" "
end
