def show_list(target):
    for i, item in enumerate(target):
        if i == len(target) - 1:
            print(item)
        else:
            print(item, end=" ")

def insection_sort(target):
    for i in range(1, len(target)):
        show_list(target)
        j = i - 1
        while j >= 0:
            if target[j] > target[j+1]:
                target[j], target[j+1] = target[j+1], target[j]
                j -= 1
            else:
                break
    return target

if __name__ == "__main__":
    n = input()
    a = [int(x) for x in input().split()]
    answer = insection_sort(a)
    show_list(answer) def show_list(target):
    for i, item in enumerate(target):
        if i == len(target) - 1:
            print(item)
        else:
            print(item, end=" ") show_list for i, item in enumerate(target):
        if i == len(target) - 1:
            print(item)
        else:
            print(item, end=" ") i item enumerate(target) enumerate target if i == len(target) - 1:
            print(item)
        else:
            print(item, end=" ") i == len(target) - 1 i len(target) - 1 len(target) len target 1 print(item) print item print(item, end=" ") print item end=" " end " " target target def insection_sort(target):
    for i in range(1, len(target)):
        show_list(target)
        j = i - 1
        while j >= 0:
            if target[j] > target[j+1]:
                target[j], target[j+1] = target[j+1], target[j]
                j -= 1
            else:
                break
    return target insection_sort for i in range(1, len(target)):
        show_list(target)
        j = i - 1
        while j >= 0:
            if target[j] > target[j+1]:
                target[j], target[j+1] = target[j+1], target[j]
                j -= 1
            else:
                break
     i range(1, len(target)) range 1 len(target) len target show_list(target) show_list target j = i - 1 j i - 1 i 1 while j >= 0:
            if target[j] > target[j+1]:
                target[j], target[j+1] = target[j+1], target[j]
                j -= 1
            else:
                break
     j >= 0 j 0 if target[j] > target[j+1]:
                target[j], target[j+1] = target[j+1], target[j]
                j -= 1
            else:
                break
     target[j] > target[j+1] target[j] target j target[j+1] target j+1 j 1 target[j], target[j+1] = target[j+1], target[j] target[j] target j target[j+1] target j+1 j 1 target[j+1] target j+1 j 1 target[j] target j j -= 1 j 1 break return target target target target if __name__ == "__main__":
    n = input()
    a = [int(x) for x in input().split()]
    answer = insection_sort(a)
    show_list(answer) __name__ == "__main__" __name__ "__main__" n = input() n input() input int(x) for x in input().split() for x in input().split() x input().split() ().split () input split for x in input().split() int(x) int x a = [int(x) for x in input().split()] a [int(x) for x in input().split()] answer = insection_sort(a) answer insection_sort(a) insection_sort a show_list(answer) show_list answer answer = insection_sort(a) insection_sort(a) answer def show_list(target):
    for i, item in enumerate(target):
        if i == len(target) - 1:
            print(item)
        else:
            print(item, end=" ") def show_list(target):
    for i, item in enumerate(target):
        if i == len(target) - 1:
            print(item)
        else:
            print(item, end=" ") show_list def insection_sort(target):
    for i in range(1, len(target)):
        show_list(target)
        j = i - 1
        while j >= 0:
            if target[j] > target[j+1]:
                target[j], target[j+1] = target[j+1], target[j]
                j -= 1
            else:
                break
    return target def insection_sort(target):
    for i in range(1, len(target)):
        show_list(target)
        j = i - 1
        while j >= 0:
            if target[j] > target[j+1]:
                target[j], target[j+1] = target[j+1], target[j]
                j -= 1
            else:
                break
    return target insection_sort a = [int(x) for x in input().split()] [int(x) for x in input().split()] a n = input() input() n
def show_list(target):
    for i, item in enumerate(target):
        if i == len(target) - 1:
            print(item)
        else:
            print(item, end=" ")

def insection_sort(target):
    for i in range(1, len(target)):
        show_list(target)
        j = i - 1
        while j >= 0:
            if target[j] > target[j+1]:
                target[j], target[j+1] = target[j+1], target[j]
                j -= 1
            else:
                break
    return target

if __name__ == "__main__":
    n = input()
    a = [int(x) for x in input().split()]
    answer = insection_sort(a)
    show_list(answer)