#coding: UTF-8

import sys

class Algo:
  @staticmethod
  def insersion_sort(A, N):
    for i in range(1, N):
      for k in A:
        if k==A[len(A)-1]:
          print(k)
        else:
          print(k, " ", sep="", end="")
      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 A:
      if k==A[len(A)-1]:
        print(k)
      else:
        print(k, " ", sep="", end="")

N = int(input())
A = list(map(int, input().split()))
Algo.insersion_sort(A, N) import sys sys class Algo:
  @staticmethod
  def insersion_sort(A, N):
    for i in range(1, N):
      for k in A:
        if k==A[len(A)-1]:
          print(k)
        else:
          print(k, " ", sep="", end="")
      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 A:
      if k==A[len(A)-1]:
        print(k)
      else:
        print(k, " ", sep="", end="") Algo def insersion_sort(A, N):
    for i in range(1, N):
      for k in A:
        if k==A[len(A)-1]:
          print(k)
        else:
          print(k, " ", sep="", end="")
      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 A:
      if k==A[len(A)-1]:
        print(k)
      else:
        print(k, " ", sep="", end="") insersion_sort for i in range(1, N):
      for k in A:
        if k==A[len(A)-1]:
          print(k)
        else:
          print(k, " ", sep="", end="")
      v = A[i]
      j = i-1
      while j >= 0 and A[j] > v:
        A[j+1] = A[j]
        j -= 1
      A[j+1] = v
     i range(1, N) range 1 N for k in A:
        if k==A[len(A)-1]:
          print(k)
        else:
          print(k, " ", sep="", end="")
       k A if k==A[len(A)-1]:
          print(k)
        else:
          print(k, " ", sep="", end="")
       k==A[len(A)-1] k A[len(A)-1] A len(A)-1 len(A) len A 1 print(k) print k print(k, " ", sep="", end="") print k " " sep="" sep "" end="" end "" 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 A:
      if k==A[len(A)-1]:
        print(k)
      else:
        print(k, " ", sep="", end="") k A if k==A[len(A)-1]:
        print(k)
      else:
        print(k, " ", sep="", end="") k==A[len(A)-1] k A[len(A)-1] A len(A)-1 len(A) len A 1 print(k) print k print(k, " ", sep="", end="") print k " " sep="" sep "" end="" end "" A A N N @staticmethod
   insersion_sort staticmethod insersion_sort N = int(input()) N int(input()) int input() input A = list(map(int, input().split())) A list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split Algo.insersion_sort(A, N) Algo.insersion_sort Algo insersion_sort A N class Algo:
  @staticmethod
  def insersion_sort(A, N):
    for i in range(1, N):
      for k in A:
        if k==A[len(A)-1]:
          print(k)
        else:
          print(k, " ", sep="", end="")
      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 A:
      if k==A[len(A)-1]:
        print(k)
      else:
        print(k, " ", sep="", end="") class Algo:
  @staticmethod
  def insersion_sort(A, N):
    for i in range(1, N):
      for k in A:
        if k==A[len(A)-1]:
          print(k)
        else:
          print(k, " ", sep="", end="")
      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 A:
      if k==A[len(A)-1]:
        print(k)
      else:
        print(k, " ", sep="", end="") Algo A = list(map(int, input().split())) list(map(int, input().split())) A N = int(input()) int(input()) N
#coding: UTF-8

import sys

class Algo:
  @staticmethod
  def insersion_sort(A, N):
    for i in range(1, N):
      for k in A:
        if k==A[len(A)-1]:
          print(k)
        else:
          print(k, " ", sep="", end="")
      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 A:
      if k==A[len(A)-1]:
        print(k)
      else:
        print(k, " ", sep="", end="")

N = int(input())
A = list(map(int, input().split()))
Algo.insersion_sort(A, N)