def insertionSort(lst, n):
    for i in range(1, n):
        v = lst[i]
        j = i - 1
        while j >= 0 and lst[j] > v:
            lst[j+1] = lst[j]
            j = j - 1
        lst[j+1] = v
        print(" ".join([str(n) for n in lst]))


if __name__ == "__main__":
    n = int(input())
    lst = [int(n) for n in input().split()]
    print(" ".join([str(n) for n in lst]))
    insertionSort(lst, n) def insertionSort(lst, n):
    for i in range(1, n):
        v = lst[i]
        j = i - 1
        while j >= 0 and lst[j] > v:
            lst[j+1] = lst[j]
            j = j - 1
        lst[j+1] = v
        print(" ".join([str(n) for n in lst])) insertionSort for i in range(1, n):
        v = lst[i]
        j = i - 1
        while j >= 0 and lst[j] > v:
            lst[j+1] = lst[j]
            j = j - 1
        lst[j+1] = v
        print(" ".join([str(n) for n in lst])) i range(1, n) range 1 n v = lst[i] v lst[i] lst i j = i - 1 j i - 1 i 1 while j >= 0 and lst[j] > v:
            lst[j+1] = lst[j]
            j = j - 1
         j >= 0 and lst[j] > v j >= 0 j 0 lst[j] > v lst[j] lst j v lst[j+1] = lst[j] lst[j+1] lst j+1 j 1 lst[j] lst j j = j - 1 j j - 1 j 1 lst[j+1] = v lst[j+1] lst j+1 j 1 v str(n) for n in lst for n in lst n lst for n in lst str(n) str n print(" ".join([str(n) for n in lst])) print " ".join([str(n) for n in lst]) " ".join " " join [str(n) for n in lst] lst lst n n if __name__ == "__main__":
    n = int(input())
    lst = [int(n) for n in input().split()]
    print(" ".join([str(n) for n in lst]))
    insertionSort(lst, 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 lst = [int(n) for n in input().split()] lst [int(n) for n in input().split()] str(n) for n in lst for n in lst n lst for n in lst str(n) str n print(" ".join([str(n) for n in lst])) print " ".join([str(n) for n in lst]) " ".join " " join [str(n) for n in lst] insertionSort(lst, n) insertionSort lst n n = int(input()) int(input()) n def insertionSort(lst, n):
    for i in range(1, n):
        v = lst[i]
        j = i - 1
        while j >= 0 and lst[j] > v:
            lst[j+1] = lst[j]
            j = j - 1
        lst[j+1] = v
        print(" ".join([str(n) for n in lst])) def insertionSort(lst, n):
    for i in range(1, n):
        v = lst[i]
        j = i - 1
        while j >= 0 and lst[j] > v:
            lst[j+1] = lst[j]
            j = j - 1
        lst[j+1] = v
        print(" ".join([str(n) for n in lst])) insertionSort lst = [int(n) for n in input().split()] [int(n) for n in input().split()] lst
def insertionSort(lst, n):
    for i in range(1, n):
        v = lst[i]
        j = i - 1
        while j >= 0 and lst[j] > v:
            lst[j+1] = lst[j]
            j = j - 1
        lst[j+1] = v
        print(" ".join([str(n) for n in lst]))


if __name__ == "__main__":
    n = int(input())
    lst = [int(n) for n in input().split()]
    print(" ".join([str(n) for n in lst]))
    insertionSort(lst, n)