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


for i in range(N):
    if N == 1:
        print(A[0])
        break
    j = i

    while j > 0 and A[j] < A[j-1]:
        if A[j] > A[j-1]:

            break
        k = A[j]
        l = A[j-1]
        A[j-1] = k
        A[j] = l
        j -= 1

    S = str(A[0])
    for k in range(1,N-1):
        S += " " + str(A[k])

    S = S + " "+str(A[N-1])
    print(S)
 N = int(input()) N int(input()) int input() input A = list(map(int, input().split())) A list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split for i in range(N):
    if N == 1:
        print(A[0])
        break
    j = i

    while j > 0 and A[j] < A[j-1]:
        if A[j] > A[j-1]:

            break
        k = A[j]
        l = A[j-1]
        A[j-1] = k
        A[j] = l
        j -= 1

    S = str(A[0])
    for k in range(1,N-1):
        S += " " + str(A[k])

    S = S + " "+str(A[N-1])
    print(S) i range(N) range N if N == 1:
        print(A[0])
        break
     N == 1 N 1 print(A[0]) print A[0] A 0 break j = i j i while j > 0 and A[j] < A[j-1]:
        if A[j] > A[j-1]:

            break
        k = A[j]
        l = A[j-1]
        A[j-1] = k
        A[j] = l
        j -= 1

     j > 0 and A[j] < A[j-1] j > 0 j 0 A[j] < A[j-1] A[j] A j A[j-1] A j-1 j 1 if A[j] > A[j-1]:

            break
         A[j] > A[j-1] A[j] A j A[j-1] A j-1 j 1 break k = A[j] k A[j] A j l = A[j-1] l A[j-1] A j-1 j 1 A[j-1] = k A[j-1] A j-1 j 1 k A[j] = l A[j] A j l j -= 1 j 1 S = str(A[0]) S str(A[0]) str A[0] A 0 for k in range(1,N-1):
        S += " " + str(A[k])

     k range(1,N-1) range 1 N-1 N 1 S += " " + str(A[k]) S " " + str(A[k]) " " str(A[k]) str A[k] A k S = S + " "+str(A[N-1]) S S + " "+str(A[N-1]) S + " " S " " str(A[N-1]) str A[N-1] A N-1 N 1 print(S) print S l = A[j-1] A[j-1] l j = i i j S = S + " "+str(A[N-1]) S + " "+str(A[N-1]) S j -= 1 1 j k = A[j] A[j] k S = str(A[0]) str(A[0]) S S += " " + str(A[k]) " " + str(A[k]) S N = int(input()) int(input()) N A = list(map(int, input().split())) list(map(int, input().split())) A
N = int(input())
A = list(map(int, input().split()))


for i in range(N):
    if N == 1:
        print(A[0])
        break
    j = i

    while j > 0 and A[j] < A[j-1]:
        if A[j] > A[j-1]:

            break
        k = A[j]
        l = A[j-1]
        A[j-1] = k
        A[j] = l
        j -= 1

    S = str(A[0])
    for k in range(1,N-1):
        S += " " + str(A[k])

    S = S + " "+str(A[N-1])
    print(S)

