def main():

    n = int(input())
    arr = list(map(int,input().split()))

    for i in range(1, len(arr)):
        j = i - 1
        v = arr[i]
        print(' '.join(map(str,arr)))
        while j >= 0 and arr[j] > v:
            arr[j+1] = arr[j]
            j -= 1
        arr[j+1] = v 
    print(' '.join(map(str,arr)))


main() def main():

    n = int(input())
    arr = list(map(int,input().split()))

    for i in range(1, len(arr)):
        j = i - 1
        v = arr[i]
        print(' '.join(map(str,arr)))
        while j >= 0 and arr[j] > v:
            arr[j+1] = arr[j]
            j -= 1
        arr[j+1] = v 
    print(' '.join(map(str,arr))) main n = int(input()) n int(input()) int input() input arr = list(map(int,input().split())) arr list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split for i in range(1, len(arr)):
        j = i - 1
        v = arr[i]
        print(' '.join(map(str,arr)))
        while j >= 0 and arr[j] > v:
            arr[j+1] = arr[j]
            j -= 1
        arr[j+1] = v 
     i range(1, len(arr)) range 1 len(arr) len arr j = i - 1 j i - 1 i 1 v = arr[i] v arr[i] arr i print(' '.join(map(str,arr))) print ' '.join(map(str,arr)) ' '.join ' ' join map(str,arr) map str arr while j >= 0 and arr[j] > v:
            arr[j+1] = arr[j]
            j -= 1
         j >= 0 and arr[j] > v j >= 0 j 0 arr[j] > v arr[j] arr j v arr[j+1] = arr[j] arr[j+1] arr j+1 j 1 arr[j] arr j j -= 1 j 1 arr[j+1] = v arr[j+1] arr j+1 j 1 v print(' '.join(map(str,arr))) print ' '.join(map(str,arr)) ' '.join ' ' join map(str,arr) map str arr main() main def main():

    n = int(input())
    arr = list(map(int,input().split()))

    for i in range(1, len(arr)):
        j = i - 1
        v = arr[i]
        print(' '.join(map(str,arr)))
        while j >= 0 and arr[j] > v:
            arr[j+1] = arr[j]
            j -= 1
        arr[j+1] = v 
    print(' '.join(map(str,arr))) def main():

    n = int(input())
    arr = list(map(int,input().split()))

    for i in range(1, len(arr)):
        j = i - 1
        v = arr[i]
        print(' '.join(map(str,arr)))
        while j >= 0 and arr[j] > v:
            arr[j+1] = arr[j]
            j -= 1
        arr[j+1] = v 
    print(' '.join(map(str,arr))) main
def main():

    n = int(input())
    arr = list(map(int,input().split()))

    for i in range(1, len(arr)):
        j = i - 1
        v = arr[i]
        print(' '.join(map(str,arr)))
        while j >= 0 and arr[j] > v:
            arr[j+1] = arr[j]
            j -= 1
        arr[j+1] = v 
    print(' '.join(map(str,arr)))


main()