def output(list):
    for i,row in enumerate(list):
        if i == 0:
            print(row,end='')
        else:
            print('',row,end='')
    
def main():
    s = input()
    s_list = []
    s_list = list(map(int,input().split()))

    output(s_list)
    print()

    i = 0
    for count in range(len(s_list)-1):

#   Judge: now > next
        if s_list[i] > s_list[i+1]:

#       Change: now > next
            ins_num = s_list[i+1]
            s_list[i+1] = s_list[i]
            s_list[i]   = ins_num

            j = i - 1

            while j >= 0:
                if s_list[j] > ins_num:
                    s_list[j+1] = s_list[j]
                    s_list[j]   = ins_num

                j -= 1
            output(s_list)
        else:
           output(s_list)        
    
        print()
        i += 1

if __name__ == '__main__':
    main() def output(list):
    for i,row in enumerate(list):
        if i == 0:
            print(row,end='')
        else:
            print('',row,end='')
     output for i,row in enumerate(list):
        if i == 0:
            print(row,end='')
        else:
            print('',row,end='')
     i row enumerate(list) enumerate list if i == 0:
            print(row,end='')
        else:
            print('',row,end='')
     i == 0 i 0 print(row,end='') print row end='' end '' print('',row,end='') print '' row end='' end '' list list def main():
    s = input()
    s_list = []
    s_list = list(map(int,input().split()))

    output(s_list)
    print()

    i = 0
    for count in range(len(s_list)-1):

#   Judge: now > next
        if s_list[i] > s_list[i+1]:

#       Change: now > next
            ins_num = s_list[i+1]
            s_list[i+1] = s_list[i]
            s_list[i]   = ins_num

            j = i - 1

            while j >= 0:
                if s_list[j] > ins_num:
                    s_list[j+1] = s_list[j]
                    s_list[j]   = ins_num

                j -= 1
            output(s_list)
        else:
           output(s_list)        
    
        print()
        i += 1 main s = input() s input() input s_list = [] s_list [] s_list = list(map(int,input().split())) s_list list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split output(s_list) output s_list print() print i = 0 i 0 for count in range(len(s_list)-1):

#   Judge: now > next
        if s_list[i] > s_list[i+1]:

#       Change: now > next
            ins_num = s_list[i+1]
            s_list[i+1] = s_list[i]
            s_list[i]   = ins_num

            j = i - 1

            while j >= 0:
                if s_list[j] > ins_num:
                    s_list[j+1] = s_list[j]
                    s_list[j]   = ins_num

                j -= 1
            output(s_list)
        else:
           output(s_list)        
    
        print()
        i += 1 count range(len(s_list)-1) range len(s_list)-1 len(s_list) len s_list 1 if s_list[i] > s_list[i+1]:

#       Change: now > next
            ins_num = s_list[i+1]
            s_list[i+1] = s_list[i]
            s_list[i]   = ins_num

            j = i - 1

            while j >= 0:
                if s_list[j] > ins_num:
                    s_list[j+1] = s_list[j]
                    s_list[j]   = ins_num

                j -= 1
            output(s_list)
        else:
           output(s_list)        
    
         s_list[i] > s_list[i+1] s_list[i] s_list i s_list[i+1] s_list i+1 i 1 ins_num = s_list[i+1] ins_num s_list[i+1] s_list i+1 i 1 s_list[i+1] = s_list[i] s_list[i+1] s_list i+1 i 1 s_list[i] s_list i s_list[i]   = ins_num s_list[i] s_list i ins_num j = i - 1 j i - 1 i 1 while j >= 0:
                if s_list[j] > ins_num:
                    s_list[j+1] = s_list[j]
                    s_list[j]   = ins_num

                j -= 1
             j >= 0 j 0 if s_list[j] > ins_num:
                    s_list[j+1] = s_list[j]
                    s_list[j]   = ins_num

                 s_list[j] > ins_num s_list[j] s_list j ins_num s_list[j+1] = s_list[j] s_list[j+1] s_list j+1 j 1 s_list[j] s_list j s_list[j]   = ins_num s_list[j] s_list j ins_num j -= 1 j 1 output(s_list) output s_list output(s_list) output s_list print() print i += 1 i 1 if __name__ == '__main__':
    main() __name__ == '__main__' __name__ '__main__' main() main def main():
    s = input()
    s_list = []
    s_list = list(map(int,input().split()))

    output(s_list)
    print()

    i = 0
    for count in range(len(s_list)-1):

#   Judge: now > next
        if s_list[i] > s_list[i+1]:

#       Change: now > next
            ins_num = s_list[i+1]
            s_list[i+1] = s_list[i]
            s_list[i]   = ins_num

            j = i - 1

            while j >= 0:
                if s_list[j] > ins_num:
                    s_list[j+1] = s_list[j]
                    s_list[j]   = ins_num

                j -= 1
            output(s_list)
        else:
           output(s_list)        
    
        print()
        i += 1 def main():
    s = input()
    s_list = []
    s_list = list(map(int,input().split()))

    output(s_list)
    print()

    i = 0
    for count in range(len(s_list)-1):

#   Judge: now > next
        if s_list[i] > s_list[i+1]:

#       Change: now > next
            ins_num = s_list[i+1]
            s_list[i+1] = s_list[i]
            s_list[i]   = ins_num

            j = i - 1

            while j >= 0:
                if s_list[j] > ins_num:
                    s_list[j+1] = s_list[j]
                    s_list[j]   = ins_num

                j -= 1
            output(s_list)
        else:
           output(s_list)        
    
        print()
        i += 1 main def output(list):
    for i,row in enumerate(list):
        if i == 0:
            print(row,end='')
        else:
            print('',row,end='')
     def output(list):
    for i,row in enumerate(list):
        if i == 0:
            print(row,end='')
        else:
            print('',row,end='')
     output
def output(list):
    for i,row in enumerate(list):
        if i == 0:
            print(row,end='')
        else:
            print('',row,end='')
    
def main():
    s = input()
    s_list = []
    s_list = list(map(int,input().split()))

    output(s_list)
    print()

    i = 0
    for count in range(len(s_list)-1):

#   Judge: now > next
        if s_list[i] > s_list[i+1]:

#       Change: now > next
            ins_num = s_list[i+1]
            s_list[i+1] = s_list[i]
            s_list[i]   = ins_num

            j = i - 1

            while j >= 0:
                if s_list[j] > ins_num:
                    s_list[j+1] = s_list[j]
                    s_list[j]   = ins_num

                j -= 1
            output(s_list)
        else:
           output(s_list)        
    
        print()
        i += 1

if __name__ == '__main__':
    main()