def solve():
    N = int(input())
    A = [int(i) for i in input().split()]

    InsertionSort(N, A)

def InsertionSort(N, A):
    print(*A)
    for i in range(1, N):
        v = A[i]
        for j in range(i - 1, -1, -1):
            if A[j] > v:
                A[j + 1] = A[j]
            else:
                A[j + 1] = v
                break
        else:
            A[0] = v

        print(*A)

if __name__ == '__main__':
    solve() def solve():
    N = int(input())
    A = [int(i) for i in input().split()]

    InsertionSort(N, A) solve N = int(input()) N int(input()) int input() input int(i) for i in input().split() for i in input().split() i input().split() ().split () input split for i in input().split() int(i) int i A = [int(i) for i in input().split()] A [int(i) for i in input().split()] InsertionSort(N, A) InsertionSort N A def InsertionSort(N, A):
    print(*A)
    for i in range(1, N):
        v = A[i]
        for j in range(i - 1, -1, -1):
            if A[j] > v:
                A[j + 1] = A[j]
            else:
                A[j + 1] = v
                break
        else:
            A[0] = v

        print(*A) InsertionSort print(*A) print *A A for i in range(1, N):
        v = A[i]
        for j in range(i - 1, -1, -1):
            if A[j] > v:
                A[j + 1] = A[j]
            else:
                A[j + 1] = v
                break
        else:
            A[0] = v

        print(*A) i range(1, N) range 1 N v = A[i] v A[i] A i for j in range(i - 1, -1, -1):
            if A[j] > v:
                A[j + 1] = A[j]
            else:
                A[j + 1] = v
                break
        else:
            A[0] = v

         j range(i - 1, -1, -1) range i - 1 i 1 -1 -1 if A[j] > v:
                A[j + 1] = A[j]
            else:
                A[j + 1] = v
                break
         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 A[j + 1] = v A[j + 1] A j + 1 j 1 v break A[0] = v A[0] A 0 v print(*A) print *A A N N A A if __name__ == '__main__':
    solve() __name__ == '__main__' __name__ '__main__' solve() solve def InsertionSort(N, A):
    print(*A)
    for i in range(1, N):
        v = A[i]
        for j in range(i - 1, -1, -1):
            if A[j] > v:
                A[j + 1] = A[j]
            else:
                A[j + 1] = v
                break
        else:
            A[0] = v

        print(*A) def InsertionSort(N, A):
    print(*A)
    for i in range(1, N):
        v = A[i]
        for j in range(i - 1, -1, -1):
            if A[j] > v:
                A[j + 1] = A[j]
            else:
                A[j + 1] = v
                break
        else:
            A[0] = v

        print(*A) InsertionSort def solve():
    N = int(input())
    A = [int(i) for i in input().split()]

    InsertionSort(N, A) def solve():
    N = int(input())
    A = [int(i) for i in input().split()]

    InsertionSort(N, A) solve
def solve():
    N = int(input())
    A = [int(i) for i in input().split()]

    InsertionSort(N, A)

def InsertionSort(N, A):
    print(*A)
    for i in range(1, N):
        v = A[i]
        for j in range(i - 1, -1, -1):
            if A[j] > v:
                A[j + 1] = A[j]
            else:
                A[j + 1] = v
                break
        else:
            A[0] = v

        print(*A)

if __name__ == '__main__':
    solve()