def main() :
    n = int(input())
    lst = [int(i) for i in input().split()]

    print(" ".join(map(str, lst)));

    for i in range(1,n) :
        for j in reversed(range(i+1)) :
            if j == 0 :
                break
            elif lst[j] < lst[j-1]:
                lst[j], lst[j-1] = lst[j-1], lst[j]
        print(" ".join(map(str, lst)))






if __name__ == '__main__' :
    main() def main() :
    n = int(input())
    lst = [int(i) for i in input().split()]

    print(" ".join(map(str, lst)));

    for i in range(1,n) :
        for j in reversed(range(i+1)) :
            if j == 0 :
                break
            elif lst[j] < lst[j-1]:
                lst[j], lst[j-1] = lst[j-1], lst[j]
        print(" ".join(map(str, lst))) main 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 lst = [int(i) for i in input().split()] lst [int(i) for i in input().split()] print(" ".join(map(str, lst))) print " ".join(map(str, lst)) " ".join " " join map(str, lst) map str lst for i in range(1,n) :
        for j in reversed(range(i+1)) :
            if j == 0 :
                break
            elif lst[j] < lst[j-1]:
                lst[j], lst[j-1] = lst[j-1], lst[j]
        print(" ".join(map(str, lst))) i range(1,n) range 1 n for j in reversed(range(i+1)) :
            if j == 0 :
                break
            elif lst[j] < lst[j-1]:
                lst[j], lst[j-1] = lst[j-1], lst[j]
         j reversed(range(i+1)) reversed range(i+1) range i+1 i 1 if j == 0 :
                break
            elif lst[j] < lst[j-1]:
                lst[j], lst[j-1] = lst[j-1], lst[j]
         j == 0 j 0 break elif lst[j] < lst[j-1]:
                lst[j], lst[j-1] = lst[j-1], lst[j]
         lst[j] < lst[j-1] lst[j] lst j lst[j-1] lst j-1 j 1 lst[j], lst[j-1] = lst[j-1], lst[j] lst[j] lst j lst[j-1] lst j-1 j 1 lst[j-1] lst j-1 j 1 lst[j] lst j print(" ".join(map(str, lst))) print " ".join(map(str, lst)) " ".join " " join map(str, lst) map str lst if __name__ == '__main__' :
    main() __name__ == '__main__' __name__ '__main__' main() main def main() :
    n = int(input())
    lst = [int(i) for i in input().split()]

    print(" ".join(map(str, lst)));

    for i in range(1,n) :
        for j in reversed(range(i+1)) :
            if j == 0 :
                break
            elif lst[j] < lst[j-1]:
                lst[j], lst[j-1] = lst[j-1], lst[j]
        print(" ".join(map(str, lst))) def main() :
    n = int(input())
    lst = [int(i) for i in input().split()]

    print(" ".join(map(str, lst)));

    for i in range(1,n) :
        for j in reversed(range(i+1)) :
            if j == 0 :
                break
            elif lst[j] < lst[j-1]:
                lst[j], lst[j-1] = lst[j-1], lst[j]
        print(" ".join(map(str, lst))) main
def main() :
    n = int(input())
    lst = [int(i) for i in input().split()]

    print(" ".join(map(str, lst)));

    for i in range(1,n) :
        for j in reversed(range(i+1)) :
            if j == 0 :
                break
            elif lst[j] < lst[j-1]:
                lst[j], lst[j-1] = lst[j-1], lst[j]
        print(" ".join(map(str, lst)))






if __name__ == '__main__' :
    main()