#!/usr/bin/env python3
# -*- coding: utf-8 -*-


def print_array(a):
    print(" ".join(map(str, a)))


def insertion_sort(a, n):
    print_array(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_array(a)
    return a


def main():
    n = int(input())
    a = list(map(int, input().split()))
    b = insertion_sort(a, n)

if __name__ == "__main__":
    main() def print_array(a):
    print(" ".join(map(str, a))) print_array print(" ".join(map(str, a))) print " ".join(map(str, a)) " ".join " " join map(str, a) map str a a a def insertion_sort(a, n):
    print_array(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_array(a)
    return a insertion_sort print_array(a) print_array 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_array(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_array(a) print_array a return a a a a n n def main():
    n = int(input())
    a = list(map(int, input().split()))
    b = insertion_sort(a, n) main n = int(input()) n int(input()) int input() input a = list(map(int, input().split())) a list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split b = insertion_sort(a, n) b insertion_sort(a, n) insertion_sort a n if __name__ == "__main__":
    main() __name__ == "__main__" __name__ "__main__" main() main def print_array(a):
    print(" ".join(map(str, a))) def print_array(a):
    print(" ".join(map(str, a))) print_array def main():
    n = int(input())
    a = list(map(int, input().split()))
    b = insertion_sort(a, n) def main():
    n = int(input())
    a = list(map(int, input().split()))
    b = insertion_sort(a, n) main def insertion_sort(a, n):
    print_array(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_array(a)
    return a def insertion_sort(a, n):
    print_array(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_array(a)
    return a insertion_sort
#!/usr/bin/env python3
# -*- coding: utf-8 -*-


def print_array(a):
    print(" ".join(map(str, a)))


def insertion_sort(a, n):
    print_array(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_array(a)
    return a


def main():
    n = int(input())
    a = list(map(int, input().split()))
    b = insertion_sort(a, n)

if __name__ == "__main__":
    main()