def get_input():
    length = int(raw_input())
    return map(int, raw_input().split())


def insertionSort(input_array):
    print " ".join(str(each)  for each in input_array).rstrip(" ")
    for i in range(1,len(input_array)):
        key = input_array[i]
        j = i-1
        while j >= 0 and input_array[j] > key:
            input_array[j+1] = input_array[j]
            j -= 1
            input_array[j+1] = key
        print " ".join(str(each)  for each in input_array).rstrip(" ")

insertionSort(get_input()) def get_input():
    length = int(raw_input())
    return map(int, raw_input().split()) get_input length = int(raw_input()) length int(raw_input()) int raw_input() raw_input return map(int, raw_input().split()) map(int, raw_input().split()) map int raw_input().split() ().split () raw_input split def insertionSort(input_array):
    print " ".join(str(each)  for each in input_array).rstrip(" ")
    for i in range(1,len(input_array)):
        key = input_array[i]
        j = i-1
        while j >= 0 and input_array[j] > key:
            input_array[j+1] = input_array[j]
            j -= 1
            input_array[j+1] = key
        print " ".join(str(each)  for each in input_array).rstrip(" ") insertionSort print " ".join(str(each)  for each in input_array).rstrip(" ") " ".join(str(each)  for each in input_array).rstrip " ".join(str(each)  for each in input_array) " ".join " " join str(each) str each rstrip " " for i in range(1,len(input_array)):
        key = input_array[i]
        j = i-1
        while j >= 0 and input_array[j] > key:
            input_array[j+1] = input_array[j]
            j -= 1
            input_array[j+1] = key
        print " ".join(str(each)  for each in input_array).rstrip(" ") i range(1,len(input_array)) range 1 len(input_array) len input_array key = input_array[i] key input_array[i] input_array i j = i-1 j i-1 i 1 while j >= 0 and input_array[j] > key:
            input_array[j+1] = input_array[j]
            j -= 1
            input_array[j+1] = key
         j >= 0 and input_array[j] > key j >= 0 j 0 input_array[j] > key input_array[j] input_array j key input_array[j+1] = input_array[j] input_array[j+1] input_array j+1 j 1 input_array[j] input_array j j -= 1 j 1 input_array[j+1] = key input_array[j+1] input_array j+1 j 1 key print " ".join(str(each)  for each in input_array).rstrip(" ") " ".join(str(each)  for each in input_array).rstrip " ".join(str(each)  for each in input_array) " ".join " " join str(each) str each rstrip " " input_array input_array insertionSort(get_input()) insertionSort get_input() get_input def get_input():
    length = int(raw_input())
    return map(int, raw_input().split()) def get_input():
    length = int(raw_input())
    return map(int, raw_input().split()) get_input def insertionSort(input_array):
    print " ".join(str(each)  for each in input_array).rstrip(" ")
    for i in range(1,len(input_array)):
        key = input_array[i]
        j = i-1
        while j >= 0 and input_array[j] > key:
            input_array[j+1] = input_array[j]
            j -= 1
            input_array[j+1] = key
        print " ".join(str(each)  for each in input_array).rstrip(" ") def insertionSort(input_array):
    print " ".join(str(each)  for each in input_array).rstrip(" ")
    for i in range(1,len(input_array)):
        key = input_array[i]
        j = i-1
        while j >= 0 and input_array[j] > key:
            input_array[j+1] = input_array[j]
            j -= 1
            input_array[j+1] = key
        print " ".join(str(each)  for each in input_array).rstrip(" ") insertionSort
def get_input():
    length = int(raw_input())
    return map(int, raw_input().split())


def insertionSort(input_array):
    print " ".join(str(each)  for each in input_array).rstrip(" ")
    for i in range(1,len(input_array)):
        key = input_array[i]
        j = i-1
        while j >= 0 and input_array[j] > key:
            input_array[j+1] = input_array[j]
            j -= 1
            input_array[j+1] = key
        print " ".join(str(each)  for each in input_array).rstrip(" ")

insertionSort(get_input())