num = int(input())
A = list(map(int, input().split(' ')))

def intersection(A,N):

    for i in range(len(A)): #output
        if i==len(A)-1:
            print(A[i])
        else:
            print(A[i], end=' ')

    for i in range(1,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

        for i in range(len(A)):
            if i == len(A) - 1: #output
                print(A[i])
            else:
                print(A[i], end=' ')

intersection(A,num) num = int(input()) num 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 ' ' def intersection(A,N):

    for i in range(len(A)): #output
        if i==len(A)-1:
            print(A[i])
        else:
            print(A[i], end=' ')

    for i in range(1,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

        for i in range(len(A)):
            if i == len(A) - 1: #output
                print(A[i])
            else:
                print(A[i], end=' ') intersection for i in range(len(A)): #output
        if i==len(A)-1:
            print(A[i])
        else:
            print(A[i], end=' ')

     i range(len(A)) range len(A) len A if i==len(A)-1:
            print(A[i])
        else:
            print(A[i], end=' ')

     i==len(A)-1 i len(A)-1 len(A) len A 1 print(A[i]) print A[i] A i print(A[i], end=' ') print A[i] A i end=' ' end ' ' for i in range(1,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

        for i in range(len(A)):
            if i == len(A) - 1: #output
                print(A[i])
            else:
                print(A[i], end=' ') i range(1,N) range 1 N v = A[i] v A[i] A i j = i-1 j i-1 i 1 while j >= 0 and A[j] > v:
            A[j+1] = A[j]
            j -= 1
         j >= 0 and A[j] > v j >= 0 j 0 A[j] > v A[j] A j v A[j+1] = A[j] A[j+1] A j+1 j 1 A[j] A j j -= 1 j 1 A[j+1] = v A[j+1] A j+1 j 1 v for i in range(len(A)):
            if i == len(A) - 1: #output
                print(A[i])
            else:
                print(A[i], end=' ') i range(len(A)) range len(A) len A if i == len(A) - 1: #output
                print(A[i])
            else:
                print(A[i], end=' ') i == len(A) - 1 i len(A) - 1 len(A) len A 1 print(A[i]) print A[i] A i print(A[i], end=' ') print A[i] A i end=' ' end ' ' A A N N intersection(A,num) intersection A num A = list(map(int, input().split(' '))) list(map(int, input().split(' '))) A def intersection(A,N):

    for i in range(len(A)): #output
        if i==len(A)-1:
            print(A[i])
        else:
            print(A[i], end=' ')

    for i in range(1,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

        for i in range(len(A)):
            if i == len(A) - 1: #output
                print(A[i])
            else:
                print(A[i], end=' ') def intersection(A,N):

    for i in range(len(A)): #output
        if i==len(A)-1:
            print(A[i])
        else:
            print(A[i], end=' ')

    for i in range(1,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

        for i in range(len(A)):
            if i == len(A) - 1: #output
                print(A[i])
            else:
                print(A[i], end=' ') intersection num = int(input()) int(input()) num
num = int(input())
A = list(map(int, input().split(' ')))

def intersection(A,N):

    for i in range(len(A)): #output
        if i==len(A)-1:
            print(A[i])
        else:
            print(A[i], end=' ')

    for i in range(1,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

        for i in range(len(A)):
            if i == len(A) - 1: #output
                print(A[i])
            else:
                print(A[i], end=' ')

intersection(A,num)