def inserts(N):
    k = 1
    for n in N:
        print(n, end='')
        if k < len(N):
            print(' ', end='')
        k += 1

    print('')
    for i in range(1,len(N)):
        # ?????????????´??????????????????£????????¨?????????
        v = N[i]
        j = i - 1
        while j >= 0 and N[j] > v:
            N[j + 1] = N[j]
            j -= 1
        N[j + 1] = v
        k = 1
        for n in N:
            print(n, end='')
            if k < len(N):
                print(' ', end='')
            k += 1
        print('')


n = int(input())
numbers = list(map(int, input().split()))

inserts(numbers) def inserts(N):
    k = 1
    for n in N:
        print(n, end='')
        if k < len(N):
            print(' ', end='')
        k += 1

    print('')
    for i in range(1,len(N)):
        # ?????????????´??????????????????£????????¨?????????
        v = N[i]
        j = i - 1
        while j >= 0 and N[j] > v:
            N[j + 1] = N[j]
            j -= 1
        N[j + 1] = v
        k = 1
        for n in N:
            print(n, end='')
            if k < len(N):
                print(' ', end='')
            k += 1
        print('') inserts k = 1 k 1 for n in N:
        print(n, end='')
        if k < len(N):
            print(' ', end='')
        k += 1

     n N print(n, end='') print n end='' end '' if k < len(N):
            print(' ', end='')
         k < len(N) k len(N) len N print(' ', end='') print ' ' end='' end '' k += 1 k 1 print('') print '' for i in range(1,len(N)):
        # ?????????????´??????????????????£????????¨?????????
        v = N[i]
        j = i - 1
        while j >= 0 and N[j] > v:
            N[j + 1] = N[j]
            j -= 1
        N[j + 1] = v
        k = 1
        for n in N:
            print(n, end='')
            if k < len(N):
                print(' ', end='')
            k += 1
        print('') i range(1,len(N)) range 1 len(N) len N v = N[i] v N[i] N i j = i - 1 j i - 1 i 1 while j >= 0 and N[j] > v:
            N[j + 1] = N[j]
            j -= 1
         j >= 0 and N[j] > v j >= 0 j 0 N[j] > v N[j] N j v N[j + 1] = N[j] N[j + 1] N j + 1 j 1 N[j] N j j -= 1 j 1 N[j + 1] = v N[j + 1] N j + 1 j 1 v k = 1 k 1 for n in N:
            print(n, end='')
            if k < len(N):
                print(' ', end='')
            k += 1
         n N print(n, end='') print n end='' end '' if k < len(N):
                print(' ', end='')
             k < len(N) k len(N) len N print(' ', end='') print ' ' end='' end '' k += 1 k 1 print('') print '' N N 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 inserts(numbers) inserts numbers numbers = list(map(int, input().split())) list(map(int, input().split())) numbers def inserts(N):
    k = 1
    for n in N:
        print(n, end='')
        if k < len(N):
            print(' ', end='')
        k += 1

    print('')
    for i in range(1,len(N)):
        # ?????????????´??????????????????£????????¨?????????
        v = N[i]
        j = i - 1
        while j >= 0 and N[j] > v:
            N[j + 1] = N[j]
            j -= 1
        N[j + 1] = v
        k = 1
        for n in N:
            print(n, end='')
            if k < len(N):
                print(' ', end='')
            k += 1
        print('') def inserts(N):
    k = 1
    for n in N:
        print(n, end='')
        if k < len(N):
            print(' ', end='')
        k += 1

    print('')
    for i in range(1,len(N)):
        # ?????????????´??????????????????£????????¨?????????
        v = N[i]
        j = i - 1
        while j >= 0 and N[j] > v:
            N[j + 1] = N[j]
            j -= 1
        N[j + 1] = v
        k = 1
        for n in N:
            print(n, end='')
            if k < len(N):
                print(' ', end='')
            k += 1
        print('') inserts n = int(input()) int(input()) n
def inserts(N):
    k = 1
    for n in N:
        print(n, end='')
        if k < len(N):
            print(' ', end='')
        k += 1

    print('')
    for i in range(1,len(N)):
        # ?????????????´??????????????????£????????¨?????????
        v = N[i]
        j = i - 1
        while j >= 0 and N[j] > v:
            N[j + 1] = N[j]
            j -= 1
        N[j + 1] = v
        k = 1
        for n in N:
            print(n, end='')
            if k < len(N):
                print(' ', end='')
            k += 1
        print('')


n = int(input())
numbers = list(map(int, input().split()))

inserts(numbers)