n = gets.to_i
a = gets.split(/ /).map(&:to_i)
(1...n).each do |i|
v = a[i]
j = i -1
while j >= 0 && a[j] > v
a[j+1] = a[j]
j -= 1
end
puts a.join(" ")
a[j+1] = v
end

__END__
1 insertionSort(A, N) // N??????????´??????????0-?????????????????????A
2   for i ??? 1 ?????? N-1 ?????§
3     v = A[i]
4     j = i - 1
5     while j >= 0 ?????? A[j] > v
6       A[j+1] = A[j]
7       j--
8     A[j+1] = v