num = gets.to_i
ary = gets.split.map(&:to_i)

puts ary.join(" ")

for i in 1..num-1

  compared = i - 1

  while compared >= 0 && ary[compared] > ary[i]

    ary[compared], ary[i] = ary[i], ary[compared]
    i -= 1
    compared -= 1
  end

  puts ary.join(" ")
end

