def insertion_sort(arr):
  print(" ".join(map(str, arr)))
  for i in range(1, len(arr)):
    key = arr[i]
    j = i - 1
    while j >= 0 and arr[j] > key:
      arr[j + 1] = arr[j]
      j -= 1
    arr[j + 1] = key
    print(" ".join(map(str, arr)))

n = int(input())
arr = list(map(int, input().split()))
insertion_sort(arr) def insertion_sort(arr):
  print(" ".join(map(str, arr)))
  for i in range(1, len(arr)):
    key = arr[i]
    j = i - 1
    while j >= 0 and arr[j] > key:
      arr[j + 1] = arr[j]
      j -= 1
    arr[j + 1] = key
    print(" ".join(map(str, arr))) insertion_sort print(" ".join(map(str, arr))) print " ".join(map(str, arr)) " ".join " " join map(str, arr) map str arr for i in range(1, len(arr)):
    key = arr[i]
    j = i - 1
    while j >= 0 and arr[j] > key:
      arr[j + 1] = arr[j]
      j -= 1
    arr[j + 1] = key
    print(" ".join(map(str, arr))) i range(1, len(arr)) range 1 len(arr) len arr key = arr[i] key arr[i] arr i j = i - 1 j i - 1 i 1 while j >= 0 and arr[j] > key:
      arr[j + 1] = arr[j]
      j -= 1
     j >= 0 and arr[j] > key j >= 0 j 0 arr[j] > key arr[j] arr j key arr[j + 1] = arr[j] arr[j + 1] arr j + 1 j 1 arr[j] arr j j -= 1 j 1 arr[j + 1] = key arr[j + 1] arr j + 1 j 1 key print(" ".join(map(str, arr))) print " ".join(map(str, arr)) " ".join " " join map(str, arr) map str arr arr arr n = int(input()) n int(input()) int input() input arr = list(map(int, input().split())) arr list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split insertion_sort(arr) insertion_sort arr arr = list(map(int, input().split())) list(map(int, input().split())) arr def insertion_sort(arr):
  print(" ".join(map(str, arr)))
  for i in range(1, len(arr)):
    key = arr[i]
    j = i - 1
    while j >= 0 and arr[j] > key:
      arr[j + 1] = arr[j]
      j -= 1
    arr[j + 1] = key
    print(" ".join(map(str, arr))) def insertion_sort(arr):
  print(" ".join(map(str, arr)))
  for i in range(1, len(arr)):
    key = arr[i]
    j = i - 1
    while j >= 0 and arr[j] > key:
      arr[j + 1] = arr[j]
      j -= 1
    arr[j + 1] = key
    print(" ".join(map(str, arr))) insertion_sort n = int(input()) int(input()) n
def insertion_sort(arr):
  print(" ".join(map(str, arr)))
  for i in range(1, len(arr)):
    key = arr[i]
    j = i - 1
    while j >= 0 and arr[j] > key:
      arr[j + 1] = arr[j]
      j -= 1
    arr[j + 1] = key
    print(" ".join(map(str, arr)))

n = int(input())
arr = list(map(int, input().split()))
insertion_sort(arr)