def inputInline():
    N = int(input())
    numbers = list(map(int, input().split(" ")))
    return numbers


def insertionSort(numbers):
    N = len(numbers)
    for i in range(1, N):
        print(" ".join(list(map(str, numbers))))
        j = i - 1
        temp = numbers[i]
        while True:
            if j == -1:
                numbers[0] = temp
                break
            if temp < numbers[j]:
                numbers[j + 1] = numbers[j]
                j -= 1
            else:
                numbers[j + 1] = temp
                break
    return " ".join(list(map(str, numbers)))


print(insertionSort(inputInline())) def inputInline():
    N = int(input())
    numbers = list(map(int, input().split(" ")))
    return numbers inputInline N = int(input()) N int(input()) int input() input numbers = list(map(int, input().split(" "))) numbers list(map(int, input().split(" "))) list map(int, input().split(" ")) map int input().split(" ") ().split () input split " " return numbers numbers def insertionSort(numbers):
    N = len(numbers)
    for i in range(1, N):
        print(" ".join(list(map(str, numbers))))
        j = i - 1
        temp = numbers[i]
        while True:
            if j == -1:
                numbers[0] = temp
                break
            if temp < numbers[j]:
                numbers[j + 1] = numbers[j]
                j -= 1
            else:
                numbers[j + 1] = temp
                break
    return " ".join(list(map(str, numbers))) insertionSort N = len(numbers) N len(numbers) len numbers for i in range(1, N):
        print(" ".join(list(map(str, numbers))))
        j = i - 1
        temp = numbers[i]
        while True:
            if j == -1:
                numbers[0] = temp
                break
            if temp < numbers[j]:
                numbers[j + 1] = numbers[j]
                j -= 1
            else:
                numbers[j + 1] = temp
                break
     i range(1, N) range 1 N print(" ".join(list(map(str, numbers)))) print " ".join(list(map(str, numbers))) " ".join " " join list(map(str, numbers)) list map(str, numbers) map str numbers j = i - 1 j i - 1 i 1 temp = numbers[i] temp numbers[i] numbers i while True:
            if j == -1:
                numbers[0] = temp
                break
            if temp < numbers[j]:
                numbers[j + 1] = numbers[j]
                j -= 1
            else:
                numbers[j + 1] = temp
                break
     True if j == -1:
                numbers[0] = temp
                break
             j == -1 j -1 numbers[0] = temp numbers[0] numbers 0 temp break if temp < numbers[j]:
                numbers[j + 1] = numbers[j]
                j -= 1
            else:
                numbers[j + 1] = temp
                break
     temp < numbers[j] temp numbers[j] numbers j numbers[j + 1] = numbers[j] numbers[j + 1] numbers j + 1 j 1 numbers[j] numbers j j -= 1 j 1 numbers[j + 1] = temp numbers[j + 1] numbers j + 1 j 1 temp break return " ".join(list(map(str, numbers))) " ".join(list(map(str, numbers))) " ".join " " join list(map(str, numbers)) list map(str, numbers) map str numbers numbers numbers print(insertionSort(inputInline())) print insertionSort(inputInline()) insertionSort inputInline() inputInline def inputInline():
    N = int(input())
    numbers = list(map(int, input().split(" ")))
    return numbers def inputInline():
    N = int(input())
    numbers = list(map(int, input().split(" ")))
    return numbers inputInline def insertionSort(numbers):
    N = len(numbers)
    for i in range(1, N):
        print(" ".join(list(map(str, numbers))))
        j = i - 1
        temp = numbers[i]
        while True:
            if j == -1:
                numbers[0] = temp
                break
            if temp < numbers[j]:
                numbers[j + 1] = numbers[j]
                j -= 1
            else:
                numbers[j + 1] = temp
                break
    return " ".join(list(map(str, numbers))) def insertionSort(numbers):
    N = len(numbers)
    for i in range(1, N):
        print(" ".join(list(map(str, numbers))))
        j = i - 1
        temp = numbers[i]
        while True:
            if j == -1:
                numbers[0] = temp
                break
            if temp < numbers[j]:
                numbers[j + 1] = numbers[j]
                j -= 1
            else:
                numbers[j + 1] = temp
                break
    return " ".join(list(map(str, numbers))) insertionSort
def inputInline():
    N = int(input())
    numbers = list(map(int, input().split(" ")))
    return numbers


def insertionSort(numbers):
    N = len(numbers)
    for i in range(1, N):
        print(" ".join(list(map(str, numbers))))
        j = i - 1
        temp = numbers[i]
        while True:
            if j == -1:
                numbers[0] = temp
                break
            if temp < numbers[j]:
                numbers[j + 1] = numbers[j]
                j -= 1
            else:
                numbers[j + 1] = temp
                break
    return " ".join(list(map(str, numbers)))


print(insertionSort(inputInline()))