n = input()
A = [int(i) for i in input().split(' ')]

def trace(A):
    for index, v in enumerate(A):
        print(v, end='')
        if index != len(A) - 1:
            print(' ', end='')
    print()

trace(A)
# algorithm
# for i in range(1, len(A)):
#     v = A[i]
#     j = i - 1
#     while j >= 0 and A[j] > v:
#         A[j+1] = A[j]
#         j -= 1
#     A[j+1] = v
#     trace(A)

for index, value in enumerate(A):
    if index == 0:
        continue

    prev_idx = index - 1
    while prev_idx >= 0 and A[prev_idx] > value:
        A[prev_idx + 1] = A[prev_idx]
        prev_idx -= 1
    A[prev_idx + 1] = value
    trace(A) n = input() n input() input int(i) for i in input().split(' ') for i in input().split(' ') i input().split(' ') ().split () input split ' ' for i in input().split(' ') int(i) int i A = [int(i) for i in input().split(' ')] A [int(i) for i in input().split(' ')] def trace(A):
    for index, v in enumerate(A):
        print(v, end='')
        if index != len(A) - 1:
            print(' ', end='')
    print() trace for index, v in enumerate(A):
        print(v, end='')
        if index != len(A) - 1:
            print(' ', end='')
     index v enumerate(A) enumerate A print(v, end='') print v end='' end '' if index != len(A) - 1:
            print(' ', end='')
     index != len(A) - 1 index len(A) - 1 len(A) len A 1 print(' ', end='') print ' ' end='' end '' print() print A A trace(A) trace A for index, value in enumerate(A):
    if index == 0:
        continue

    prev_idx = index - 1
    while prev_idx >= 0 and A[prev_idx] > value:
        A[prev_idx + 1] = A[prev_idx]
        prev_idx -= 1
    A[prev_idx + 1] = value
    trace(A) index value enumerate(A) enumerate A if index == 0:
        continue

     index == 0 index 0 continue prev_idx = index - 1 prev_idx index - 1 index 1 while prev_idx >= 0 and A[prev_idx] > value:
        A[prev_idx + 1] = A[prev_idx]
        prev_idx -= 1
     prev_idx >= 0 and A[prev_idx] > value prev_idx >= 0 prev_idx 0 A[prev_idx] > value A[prev_idx] A prev_idx value A[prev_idx + 1] = A[prev_idx] A[prev_idx + 1] A prev_idx + 1 prev_idx 1 A[prev_idx] A prev_idx prev_idx -= 1 prev_idx 1 A[prev_idx + 1] = value A[prev_idx + 1] A prev_idx + 1 prev_idx 1 value trace(A) trace A prev_idx -= 1 1 prev_idx def trace(A):
    for index, v in enumerate(A):
        print(v, end='')
        if index != len(A) - 1:
            print(' ', end='')
    print() def trace(A):
    for index, v in enumerate(A):
        print(v, end='')
        if index != len(A) - 1:
            print(' ', end='')
    print() trace prev_idx = index - 1 index - 1 prev_idx n = input() input() n A = [int(i) for i in input().split(' ')] [int(i) for i in input().split(' ')] A
n = input()
A = [int(i) for i in input().split(' ')]

def trace(A):
    for index, v in enumerate(A):
        print(v, end='')
        if index != len(A) - 1:
            print(' ', end='')
    print()

trace(A)
# algorithm
# for i in range(1, len(A)):
#     v = A[i]
#     j = i - 1
#     while j >= 0 and A[j] > v:
#         A[j+1] = A[j]
#         j -= 1
#     A[j+1] = v
#     trace(A)

for index, value in enumerate(A):
    if index == 0:
        continue

    prev_idx = index - 1
    while prev_idx >= 0 and A[prev_idx] > value:
        A[prev_idx + 1] = A[prev_idx]
        prev_idx -= 1
    A[prev_idx + 1] = value
    trace(A)