def insertion(A):
    for i in range(len(A)):
        key = A[i]
        j = i - 1
        while j >= 0 and A[j] > key:
            A[j+1] = A[j]
            j -= 1
        A[j+1] = key
        print(' '.join([str(x) for x in A]))

N = int(input())
A = [int(x) for x in input().strip().split(' ')]
insertion(A) def insertion(A):
    for i in range(len(A)):
        key = A[i]
        j = i - 1
        while j >= 0 and A[j] > key:
            A[j+1] = A[j]
            j -= 1
        A[j+1] = key
        print(' '.join([str(x) for x in A])) insertion for i in range(len(A)):
        key = A[i]
        j = i - 1
        while j >= 0 and A[j] > key:
            A[j+1] = A[j]
            j -= 1
        A[j+1] = key
        print(' '.join([str(x) for x in A])) i range(len(A)) range len(A) len A key = A[i] key A[i] A i j = i - 1 j i - 1 i 1 while j >= 0 and A[j] > key:
            A[j+1] = A[j]
            j -= 1
         j >= 0 and A[j] > key j >= 0 j 0 A[j] > key A[j] A j key A[j+1] = A[j] A[j+1] A j+1 j 1 A[j] A j j -= 1 j 1 A[j+1] = key A[j+1] A j+1 j 1 key str(x) for x in A for x in A x A for x in A str(x) str x print(' '.join([str(x) for x in A])) print ' '.join([str(x) for x in A]) ' '.join ' ' join [str(x) for x in A] A A N = int(input()) N int(input()) int input() input int(x) for x in input().strip().split(' ') for x in input().strip().split(' ') x input().strip().split(' ') ().strip().split ().strip() ().strip () input strip split ' ' for x in input().strip().split(' ') int(x) int x A = [int(x) for x in input().strip().split(' ')] A [int(x) for x in input().strip().split(' ')] insertion(A) insertion A def insertion(A):
    for i in range(len(A)):
        key = A[i]
        j = i - 1
        while j >= 0 and A[j] > key:
            A[j+1] = A[j]
            j -= 1
        A[j+1] = key
        print(' '.join([str(x) for x in A])) def insertion(A):
    for i in range(len(A)):
        key = A[i]
        j = i - 1
        while j >= 0 and A[j] > key:
            A[j+1] = A[j]
            j -= 1
        A[j+1] = key
        print(' '.join([str(x) for x in A])) insertion A = [int(x) for x in input().strip().split(' ')] [int(x) for x in input().strip().split(' ')] A N = int(input()) int(input()) N
def insertion(A):
    for i in range(len(A)):
        key = A[i]
        j = i - 1
        while j >= 0 and A[j] > key:
            A[j+1] = A[j]
            j -= 1
        A[j+1] = key
        print(' '.join([str(x) for x in A]))

N = int(input())
A = [int(x) for x in input().strip().split(' ')]
insertion(A)