def printAry(ary)
  for i in 0..ary.length - 1 do
    if i == 0 then
      printf("#{ary[i]}")
    else
      printf(" #{ary[i]}")
    end
  end
  printf("\n")
end

### main ###
str = STDIN.gets
ary = STDIN.gets.to_s.split(" ")

ary.map!(&:to_i)

printAry(ary)

for i in 1..ary.length - 1 do
  v = ary[i]
  j = i - 1
  while j >= 0 && ary[j] > v do
    ary[j+1] = ary[j]
    j = j - 1
  end
  ary[j+1] = v
  printAry(ary)
end