def insertion_sort(a, n):
    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([str(i) for i in a]))


n = int(input())
a = [int(i) for i in input().split()]
print(' '.join([str(i) for i in a]))

insertion_sort(a, n) def insertion_sort(a, n):
    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([str(i) for i in a])) insertion_sort 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([str(i) for i in 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 str(i) for i in a for i in a i a for i in a str(i) str i print(' '.join([str(i) for i in a])) print ' '.join([str(i) for i in a]) ' '.join ' ' join [str(i) for i in a] a a n n 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()] str(i) for i in a for i in a i a for i in a str(i) str i print(' '.join([str(i) for i in a])) print ' '.join([str(i) for i in a]) ' '.join ' ' join [str(i) for i in a] insertion_sort(a, n) insertion_sort a n def insertion_sort(a, n):
    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([str(i) for i in a])) def insertion_sort(a, n):
    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([str(i) for i in a])) insertion_sort a = [int(i) for i in input().split()] [int(i) for i in input().split()] a n = int(input()) int(input()) n
def insertion_sort(a, n):
    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([str(i) for i in a]))


n = int(input())
a = [int(i) for i in input().split()]
print(' '.join([str(i) for i in a]))

insertion_sort(a, n)
