def main():
    _ = input()
    array = [int(x) for x in input().split()]
    print(" ".join(map(str, array)))

    for i in range(1, len(array)):
        moving = array[i]
        j = i - 1
        while j >= 0 and moving < array[j]:
            array[j+1] = array[j]
            j -= 1
        array[j+1] = moving
        print(" ".join(map(str, array)))
    return


main() def main():
    _ = input()
    array = [int(x) for x in input().split()]
    print(" ".join(map(str, array)))

    for i in range(1, len(array)):
        moving = array[i]
        j = i - 1
        while j >= 0 and moving < array[j]:
            array[j+1] = array[j]
            j -= 1
        array[j+1] = moving
        print(" ".join(map(str, array)))
    return main _ = input() _ 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 array = [int(x) for x in input().split()] array [int(x) for x in input().split()] print(" ".join(map(str, array))) print " ".join(map(str, array)) " ".join " " join map(str, array) map str array for i in range(1, len(array)):
        moving = array[i]
        j = i - 1
        while j >= 0 and moving < array[j]:
            array[j+1] = array[j]
            j -= 1
        array[j+1] = moving
        print(" ".join(map(str, array)))
     i range(1, len(array)) range 1 len(array) len array moving = array[i] moving array[i] array i j = i - 1 j i - 1 i 1 while j >= 0 and moving < array[j]:
            array[j+1] = array[j]
            j -= 1
         j >= 0 and moving < array[j] j >= 0 j 0 moving < array[j] moving array[j] array j array[j+1] = array[j] array[j+1] array j+1 j 1 array[j] array j j -= 1 j 1 array[j+1] = moving array[j+1] array j+1 j 1 moving print(" ".join(map(str, array))) print " ".join(map(str, array)) " ".join " " join map(str, array) map str array return main() main def main():
    _ = input()
    array = [int(x) for x in input().split()]
    print(" ".join(map(str, array)))

    for i in range(1, len(array)):
        moving = array[i]
        j = i - 1
        while j >= 0 and moving < array[j]:
            array[j+1] = array[j]
            j -= 1
        array[j+1] = moving
        print(" ".join(map(str, array)))
    return def main():
    _ = input()
    array = [int(x) for x in input().split()]
    print(" ".join(map(str, array)))

    for i in range(1, len(array)):
        moving = array[i]
        j = i - 1
        while j >= 0 and moving < array[j]:
            array[j+1] = array[j]
            j -= 1
        array[j+1] = moving
        print(" ".join(map(str, array)))
    return main
def main():
    _ = input()
    array = [int(x) for x in input().split()]
    print(" ".join(map(str, array)))

    for i in range(1, len(array)):
        moving = array[i]
        j = i - 1
        while j >= 0 and moving < array[j]:
            array[j+1] = array[j]
            j -= 1
        array[j+1] = moving
        print(" ".join(map(str, array)))
    return


main()
