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

def main():
    N = int(input().rstrip())
    A = list(map(int, input().rstrip().split()))
    
    insertion_sort(A, N)
    
if __name__ == '__main__':
    main() def insertion_sort(A, N):
    for i  in range(N):
        v = A[i]
        j = i - 1
        while j >= 0 and A[j] > v:
            A[j + 1] = A[j]
            j -= 1
        A[j + 1] = v
        
        print(' '.join(map(str, A))) insertion_sort for i  in range(N):
        v = A[i]
        j = i - 1
        while j >= 0 and A[j] > v:
            A[j + 1] = A[j]
            j -= 1
        A[j + 1] = v
        
        print(' '.join(map(str, A))) i range(N) range N v = A[i] v A[i] A i j = i - 1 j i - 1 i 1 while j >= 0 and A[j] > v:
            A[j + 1] = A[j]
            j -= 1
         j >= 0 and A[j] > v j >= 0 j 0 A[j] > v A[j] A j v A[j + 1] = A[j] A[j + 1] A j + 1 j 1 A[j] A j j -= 1 j 1 A[j + 1] = v A[j + 1] A j + 1 j 1 v print(' '.join(map(str, A))) print ' '.join(map(str, A)) ' '.join ' ' join map(str, A) map str A A A N N def main():
    N = int(input().rstrip())
    A = list(map(int, input().rstrip().split()))
    
    insertion_sort(A, N)
     main N = int(input().rstrip()) N int(input().rstrip()) int input().rstrip() ().rstrip () input rstrip A = list(map(int, input().rstrip().split())) A list(map(int, input().rstrip().split())) list map(int, input().rstrip().split()) map int input().rstrip().split() ().rstrip().split ().rstrip() ().rstrip () input rstrip split insertion_sort(A, N) insertion_sort A N if __name__ == '__main__':
    main() __name__ == '__main__' __name__ '__main__' main() main def insertion_sort(A, N):
    for i  in range(N):
        v = A[i]
        j = i - 1
        while j >= 0 and A[j] > v:
            A[j + 1] = A[j]
            j -= 1
        A[j + 1] = v
        
        print(' '.join(map(str, A))) def insertion_sort(A, N):
    for i  in range(N):
        v = A[i]
        j = i - 1
        while j >= 0 and A[j] > v:
            A[j + 1] = A[j]
            j -= 1
        A[j + 1] = v
        
        print(' '.join(map(str, A))) insertion_sort def main():
    N = int(input().rstrip())
    A = list(map(int, input().rstrip().split()))
    
    insertion_sort(A, N)
     def main():
    N = int(input().rstrip())
    A = list(map(int, input().rstrip().split()))
    
    insertion_sort(A, N)
     main
def insertion_sort(A, N):
    for i  in range(N):
        v = A[i]
        j = i - 1
        while j >= 0 and A[j] > v:
            A[j + 1] = A[j]
            j -= 1
        A[j + 1] = v
        
        print(' '.join(map(str, A)))

def main():
    N = int(input().rstrip())
    A = list(map(int, input().rstrip().split()))
    
    insertion_sort(A, N)
    
if __name__ == '__main__':
    main()