def insertionSort(lst, n):
    print(" ".join([str(n) for n in lst]))
    for i in range(1, n):
        v = lst[i]
        for j in range(0, i):
            if lst[j] > v:
                lst.insert(j, lst.pop(i))
                break

        print(" ".join([str(n) for n in lst]))

    return lst


if __name__ == "__main__":
    n = int(input())
    lst = [int(n) for n in input().split()]
    insertionSort(lst, n) def insertionSort(lst, n):
    print(" ".join([str(n) for n in lst]))
    for i in range(1, n):
        v = lst[i]
        for j in range(0, i):
            if lst[j] > v:
                lst.insert(j, lst.pop(i))
                break

        print(" ".join([str(n) for n in lst]))

    return lst insertionSort 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] for i in range(1, n):
        v = lst[i]
        for j in range(0, i):
            if lst[j] > v:
                lst.insert(j, lst.pop(i))
                break

        print(" ".join([str(n) for n in lst]))

     i range(1, n) range 1 n v = lst[i] v lst[i] lst i for j in range(0, i):
            if lst[j] > v:
                lst.insert(j, lst.pop(i))
                break

         j range(0, i) range 0 i if lst[j] > v:
                lst.insert(j, lst.pop(i))
                break

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

        print(" ".join([str(n) for n in lst]))

    return lst def insertionSort(lst, n):
    print(" ".join([str(n) for n in lst]))
    for i in range(1, n):
        v = lst[i]
        for j in range(0, i):
            if lst[j] > v:
                lst.insert(j, lst.pop(i))
                break

        print(" ".join([str(n) for n in lst]))

    return lst insertionSort
def insertionSort(lst, n):
    print(" ".join([str(n) for n in lst]))
    for i in range(1, n):
        v = lst[i]
        for j in range(0, i):
            if lst[j] > v:
                lst.insert(j, lst.pop(i))
                break

        print(" ".join([str(n) for n in lst]))

    return lst


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