def inserrtionsort(l,n):
  for i in range(1,n):
    print(" ".join(l))
    v=l[i]
    j=i-1
    while int(v)<int(l[j]) and j>=0:
      l[j+1]=l[j]
      j-=1
    l[j+1]=v
  print(" ".join(l))
m=int(input())
n=list(input().split())
inserrtionsort(n,m) def inserrtionsort(l,n):
  for i in range(1,n):
    print(" ".join(l))
    v=l[i]
    j=i-1
    while int(v)<int(l[j]) and j>=0:
      l[j+1]=l[j]
      j-=1
    l[j+1]=v
  print(" ".join(l)) inserrtionsort for i in range(1,n):
    print(" ".join(l))
    v=l[i]
    j=i-1
    while int(v)<int(l[j]) and j>=0:
      l[j+1]=l[j]
      j-=1
    l[j+1]=v
   i range(1,n) range 1 n print(" ".join(l)) print " ".join(l) " ".join " " join l v=l[i] v l[i] l i j=i-1 j i-1 i 1 while int(v)<int(l[j]) and j>=0:
      l[j+1]=l[j]
      j-=1
     int(v)<int(l[j]) and j>=0 int(v)<int(l[j]) int(v) int v int(l[j]) int l[j] l j j>=0 j 0 l[j+1]=l[j] l[j+1] l j+1 j 1 l[j] l j j-=1 j 1 l[j+1]=v l[j+1] l j+1 j 1 v print(" ".join(l)) print " ".join(l) " ".join " " join l l l n n m=int(input()) m int(input()) int input() input n=list(input().split()) n list(input().split()) list input().split() ().split () input split inserrtionsort(n,m) inserrtionsort n m m=int(input()) int(input()) m n=list(input().split()) list(input().split()) n def inserrtionsort(l,n):
  for i in range(1,n):
    print(" ".join(l))
    v=l[i]
    j=i-1
    while int(v)<int(l[j]) and j>=0:
      l[j+1]=l[j]
      j-=1
    l[j+1]=v
  print(" ".join(l)) def inserrtionsort(l,n):
  for i in range(1,n):
    print(" ".join(l))
    v=l[i]
    j=i-1
    while int(v)<int(l[j]) and j>=0:
      l[j+1]=l[j]
      j-=1
    l[j+1]=v
  print(" ".join(l)) inserrtionsort
def inserrtionsort(l,n):
  for i in range(1,n):
    print(" ".join(l))
    v=l[i]
    j=i-1
    while int(v)<int(l[j]) and j>=0:
      l[j+1]=l[j]
      j-=1
    l[j+1]=v
  print(" ".join(l))
m=int(input())
n=list(input().split())
inserrtionsort(n,m)
