# -*- coding: utf-8 -*-


def insertion_sort(a, n):
    for i in range(n):
        tmp = a[i]
        j = i - 1
        while j >= 0 and a[j] > tmp:
            a[j + 1] = a[j]
            j -= 1
        a[j + 1] = tmp
        print(' '.join(map(str, a)))

if __name__ == '__main__':
    n = int(input())
    a = [int(n) for n in input().split()]
    insertion_sort(a, n) def insertion_sort(a, n):
    for i in range(n):
        tmp = a[i]
        j = i - 1
        while j >= 0 and a[j] > tmp:
            a[j + 1] = a[j]
            j -= 1
        a[j + 1] = tmp
        print(' '.join(map(str, a))) insertion_sort for i in range(n):
        tmp = a[i]
        j = i - 1
        while j >= 0 and a[j] > tmp:
            a[j + 1] = a[j]
            j -= 1
        a[j + 1] = tmp
        print(' '.join(map(str, a))) i range(n) range n tmp = a[i] tmp a[i] a i j = i - 1 j i - 1 i 1 while j >= 0 and a[j] > tmp:
            a[j + 1] = a[j]
            j -= 1
         j >= 0 and a[j] > tmp j >= 0 j 0 a[j] > tmp a[j] a j tmp a[j + 1] = a[j] a[j + 1] a j + 1 j 1 a[j] a j j -= 1 j 1 a[j + 1] = tmp a[j + 1] a j + 1 j 1 tmp print(' '.join(map(str, a))) print ' '.join(map(str, a)) ' '.join ' ' join map(str, a) map str a a a n n if __name__ == '__main__':
    n = int(input())
    a = [int(n) for n in input().split()]
    insertion_sort(a, n) __name__ == '__main__' __name__ '__main__' n = int(input()) n int(input()) int input() input int(n) for n in input().split() for n in input().split() n input().split() ().split () input split for n in input().split() int(n) int n a = [int(n) for n in input().split()] a [int(n) for n in input().split()] insertion_sort(a, n) insertion_sort a n def insertion_sort(a, n):
    for i in range(n):
        tmp = a[i]
        j = i - 1
        while j >= 0 and a[j] > tmp:
            a[j + 1] = a[j]
            j -= 1
        a[j + 1] = tmp
        print(' '.join(map(str, a))) def insertion_sort(a, n):
    for i in range(n):
        tmp = a[i]
        j = i - 1
        while j >= 0 and a[j] > tmp:
            a[j + 1] = a[j]
            j -= 1
        a[j + 1] = tmp
        print(' '.join(map(str, a))) insertion_sort n = int(input()) int(input()) n a = [int(n) for n in input().split()] [int(n) for n in input().split()] a
# -*- coding: utf-8 -*-


def insertion_sort(a, n):
    for i in range(n):
        tmp = a[i]
        j = i - 1
        while j >= 0 and a[j] > tmp:
            a[j + 1] = a[j]
            j -= 1
        a[j + 1] = tmp
        print(' '.join(map(str, a)))

if __name__ == '__main__':
    n = int(input())
    a = [int(n) for n in input().split()]
    insertion_sort(a, n)