list_len = int(input().rstrip())

num_list = list(map(int, input().rstrip().split()))



for i in range(list_len):

    v = num_list[i]



    j = i - 1

    while j >= 0 and num_list[j] > v:

        num_list[j + 1] = num_list[j]

        j -= 1

    num_list[j+1] = v

    

    output_str = ' '.join(map(str, num_list))

    print(output_str)
def insertion_sort(A, N):

    for i  in range(N):

        v = A[i]

        j = i - 1

        while j >= 0 and A[j] > v:

            A[j + 1] = A[j]

            j -= 1

        A[j + 1] = v

        

        print((' '.join(map(str, A))))



def main():

    N = int(input().rstrip())

    A = list(map(int, input().rstrip().split()))

    

    insertion_sort(A, N)

    

if __name__ == '__main__':

    main()
list_len = int(input().rstrip())
num_list = list(map(int, input().rstrip().split()))
for i in range(list_len):
    v = num_list[i]
    j = i - 1
    while j >= 0 and num_list[j] > v:
        num_list[j + 1] = num_list[j]
        j -= 1
    num_list[j + 1] = v
    output_str = " ".join(map(str, num_list))
    print(output_str)

def insertion_sort(A, N):
    for i in range(N):
        v = A[i]
        j = i - 1
        while j >= 0 and A[j] > v:
            A[j + 1] = A[j]
            j -= 1
        A[j + 1] = v
        print((" ".join(map(str, A))))


def main():
    N = int(input().rstrip())
    A = list(map(int, input().rstrip().split()))
    insertion_sort(A, N)


if __name__ == "__main__":
    main()

-list_len = int(input().rstrip()) -num_list = list(map(int, input().rstrip().split())) -for i in range(list_len): -    v = num_list[i] -    j = i - 1 -    while j >= 0 and num_list[j] > v: -        num_list[j + 1] = num_list[j] -        j -= 1 -    num_list[j + 1] = v -    output_str = " ".join(map(str, num_list)) -    print(output_str) +def insertion_sort(A, N): +    for i in range(N): +        v = A[i] +        j = i - 1 +        while j >= 0 and A[j] > v: +            A[j + 1] = A[j] +            j -= 1 +        A[j + 1] = v +        print((" ".join(map(str, A)))) + + +def main(): +    N = int(input().rstrip()) +    A = list(map(int, input().rstrip().split())) +    insertion_sort(A, N) + + +if __name__ == "__main__": +    main()