#coding: utf-8
#ALDS1_1A
import sys

n=int(raw_input())
a=map(int,raw_input().split())

for i in xrange(n):
  print a[i],
print
for i in xrange(1,n):
 v=a[i]
 j=i-1
 while j>=0 and a[j]>v:
  a[j+1]=a[j]
  j-=1
 a[j+1]=v
 for k in xrange(n):
  print a[k],
 print import sys sys n=int(raw_input()) n int(raw_input()) int raw_input() raw_input a=map(int,raw_input().split()) a map(int,raw_input().split()) map int raw_input().split() ().split () raw_input split for i in xrange(n):
  print a[i], i xrange(n) xrange n print a[i] a i print for i in xrange(1,n):
 v=a[i]
 j=i-1
 while j>=0 and a[j]>v:
  a[j+1]=a[j]
  j-=1
 a[j+1]=v
 for k in xrange(n):
  print a[k],
 print i xrange(1,n) xrange 1 n v=a[i] v a[i] a i j=i-1 j i-1 i 1 while j>=0 and a[j]>v:
  a[j+1]=a[j]
  j-=1
  j>=0 and a[j]>v j>=0 j 0 a[j]>v a[j] a j v a[j+1]=a[j] a[j+1] a j+1 j 1 a[j] a j j-=1 j 1 a[j+1]=v a[j+1] a j+1 j 1 v for k in xrange(n):
  print a[k],
  k xrange(n) xrange n print a[k] a k print j-=1 1 j j=i-1 i-1 j n=int(raw_input()) int(raw_input()) n a=map(int,raw_input().split()) map(int,raw_input().split()) a v=a[i] a[i] v
#coding: utf-8
#ALDS1_1A
import sys

n=int(raw_input())
a=map(int,raw_input().split())

for i in xrange(n):
  print a[i],
print
for i in xrange(1,n):
 v=a[i]
 j=i-1
 while j>=0 and a[j]>v:
  a[j+1]=a[j]
  j-=1
 a[j+1]=v
 for k in xrange(n):
  print a[k],
 print