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

puts ary.join(" ")

for i in 1..num-1

  check = i

  while check >= 1 && ary[check - 1] > ary[check]

    ary[check - 1], ary[check] = ary[check], ary[check - 1]
    check -= 1
  end

  puts ary.join(" ")
end

