#!/usr/bin/python

import sys


def main():
  length = int(input())
  elements = list(map(int, input().split()))
  print(" ".join(str(i) for i in elements))

  sorted_list = [elements[0]]
  for i in range(1, length):
    element = elements[i]
    for j in range(0, len(sorted_list) + 1):
      if j == len(sorted_list):
        sorted_list.append(element)
      elif element < sorted_list[j]:
        sorted_list.insert(j, element)
        break
    output_list = sorted_list[0:i+1] + elements[i+1:]
    print(" ".join([str(i) for i in output_list]))

  return 0

if __name__ == '__main__':
  main() import sys sys def main():
  length = int(input())
  elements = list(map(int, input().split()))
  print(" ".join(str(i) for i in elements))

  sorted_list = [elements[0]]
  for i in range(1, length):
    element = elements[i]
    for j in range(0, len(sorted_list) + 1):
      if j == len(sorted_list):
        sorted_list.append(element)
      elif element < sorted_list[j]:
        sorted_list.insert(j, element)
        break
    output_list = sorted_list[0:i+1] + elements[i+1:]
    print(" ".join([str(i) for i in output_list]))

  return 0 main length = int(input()) length int(input()) int input() input elements = list(map(int, input().split())) elements list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split print(" ".join(str(i) for i in elements)) print " ".join(str(i) for i in elements) " ".join " " join str(i) str i sorted_list = [elements[0]] sorted_list [elements[0]] elements[0] elements 0 for i in range(1, length):
    element = elements[i]
    for j in range(0, len(sorted_list) + 1):
      if j == len(sorted_list):
        sorted_list.append(element)
      elif element < sorted_list[j]:
        sorted_list.insert(j, element)
        break
    output_list = sorted_list[0:i+1] + elements[i+1:]
    print(" ".join([str(i) for i in output_list]))

   i range(1, length) range 1 length element = elements[i] element elements[i] elements i for j in range(0, len(sorted_list) + 1):
      if j == len(sorted_list):
        sorted_list.append(element)
      elif element < sorted_list[j]:
        sorted_list.insert(j, element)
        break
     j range(0, len(sorted_list) + 1) range 0 len(sorted_list) + 1 len(sorted_list) len sorted_list 1 if j == len(sorted_list):
        sorted_list.append(element)
      elif element < sorted_list[j]:
        sorted_list.insert(j, element)
        break
     j == len(sorted_list) j len(sorted_list) len sorted_list sorted_list.append(element) sorted_list.append sorted_list append element elif element < sorted_list[j]:
        sorted_list.insert(j, element)
        break
     element < sorted_list[j] element sorted_list[j] sorted_list j sorted_list.insert(j, element) sorted_list.insert sorted_list insert j element break output_list = sorted_list[0:i+1] + elements[i+1:] output_list sorted_list[0:i+1] + elements[i+1:] sorted_list[0:i+1] sorted_list 0:i+1 0 i+1 i 1 elements[i+1:] elements i+1: i+1 i 1 str(i) for i in output_list for i in output_list i output_list for i in output_list str(i) str i print(" ".join([str(i) for i in output_list])) print " ".join([str(i) for i in output_list]) " ".join " " join [str(i) for i in output_list] return 0 0 if __name__ == '__main__':
  main() __name__ == '__main__' __name__ '__main__' main() main def main():
  length = int(input())
  elements = list(map(int, input().split()))
  print(" ".join(str(i) for i in elements))

  sorted_list = [elements[0]]
  for i in range(1, length):
    element = elements[i]
    for j in range(0, len(sorted_list) + 1):
      if j == len(sorted_list):
        sorted_list.append(element)
      elif element < sorted_list[j]:
        sorted_list.insert(j, element)
        break
    output_list = sorted_list[0:i+1] + elements[i+1:]
    print(" ".join([str(i) for i in output_list]))

  return 0 def main():
  length = int(input())
  elements = list(map(int, input().split()))
  print(" ".join(str(i) for i in elements))

  sorted_list = [elements[0]]
  for i in range(1, length):
    element = elements[i]
    for j in range(0, len(sorted_list) + 1):
      if j == len(sorted_list):
        sorted_list.append(element)
      elif element < sorted_list[j]:
        sorted_list.insert(j, element)
        break
    output_list = sorted_list[0:i+1] + elements[i+1:]
    print(" ".join([str(i) for i in output_list]))

  return 0 main
#!/usr/bin/python

import sys


def main():
  length = int(input())
  elements = list(map(int, input().split()))
  print(" ".join(str(i) for i in elements))

  sorted_list = [elements[0]]
  for i in range(1, length):
    element = elements[i]
    for j in range(0, len(sorted_list) + 1):
      if j == len(sorted_list):
        sorted_list.append(element)
      elif element < sorted_list[j]:
        sorted_list.insert(j, element)
        break
    output_list = sorted_list[0:i+1] + elements[i+1:]
    print(" ".join([str(i) for i in output_list]))

  return 0

if __name__ == '__main__':
  main()