# coding=utf-8


def insertionSort(A, N):
    print ' '.join(map(str, A))
    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
        print ' '.join(map(str, A))
    return A


n = int(raw_input().rstrip())
a = map(int, raw_input().rstrip().split())
insertionSort(a, n) def insertionSort(A, N):
    print ' '.join(map(str, A))
    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
        print ' '.join(map(str, A))
    return A insertionSort print ' '.join(map(str, A)) ' '.join ' ' join map(str, A) map str A 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
        print ' '.join(map(str, A))
     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 print ' '.join(map(str, A)) ' '.join ' ' join map(str, A) map str A return A A A A N N n = int(raw_input().rstrip()) n int(raw_input().rstrip()) int raw_input().rstrip() ().rstrip () raw_input rstrip a = map(int, raw_input().rstrip().split()) a map(int, raw_input().rstrip().split()) map int raw_input().rstrip().split() ().rstrip().split ().rstrip() ().rstrip () raw_input rstrip split insertionSort(a, n) insertionSort a n n = int(raw_input().rstrip()) int(raw_input().rstrip()) n def insertionSort(A, N):
    print ' '.join(map(str, A))
    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
        print ' '.join(map(str, A))
    return A def insertionSort(A, N):
    print ' '.join(map(str, A))
    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
        print ' '.join(map(str, A))
    return A insertionSort a = map(int, raw_input().rstrip().split()) map(int, raw_input().rstrip().split()) a
# coding=utf-8


def insertionSort(A, N):
    print ' '.join(map(str, A))
    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
        print ' '.join(map(str, A))
    return A


n = int(raw_input().rstrip())
a = map(int, raw_input().rstrip().split())
insertionSort(a, n)