#! /usr/bin/ruby -w
# encoding: utf-8
#

def puts_array(a)
  sep = ''
  a.each do |e|
    print sep + e.to_s
    sep = ' '
  end
  puts
end

def insertion_sort(a, n)
  1.upto(n - 1) do |i|
    puts_array(a)
    v = a[i]
    j = i - 1
    while 0 <= j and v < a[j]
      # ?????????
      a[j + 1] = a[j]
      j -= 1
    end
    #???????????¨??????????????????
    a[j + 1] = v

  end
  puts_array(a)
end

if $0 == __FILE__
  n = gets.to_i
  a = gets.chomp.split.map(&:to_i)
  insertion_sort(a, n)
end