def insertion_sort(target_list):
    sorted_list = list()
    for target in target_list[:]:
        for i, num in enumerate(sorted_list):
            if num > target:
                sorted_list[i:i] = [target]
                break
        else:
            sorted_list.append(target)
        target_list.pop(0)
        print(' '.join(str(s) for s in sorted_list + target_list))

N = int(input())
A = [int(s) for s in input().split()]
insertion_sort(A) def insertion_sort(target_list):
    sorted_list = list()
    for target in target_list[:]:
        for i, num in enumerate(sorted_list):
            if num > target:
                sorted_list[i:i] = [target]
                break
        else:
            sorted_list.append(target)
        target_list.pop(0)
        print(' '.join(str(s) for s in sorted_list + target_list)) insertion_sort sorted_list = list() sorted_list list() list for target in target_list[:]:
        for i, num in enumerate(sorted_list):
            if num > target:
                sorted_list[i:i] = [target]
                break
        else:
            sorted_list.append(target)
        target_list.pop(0)
        print(' '.join(str(s) for s in sorted_list + target_list)) target target_list[:] target_list : for i, num in enumerate(sorted_list):
            if num > target:
                sorted_list[i:i] = [target]
                break
        else:
            sorted_list.append(target)
         i num enumerate(sorted_list) enumerate sorted_list if num > target:
                sorted_list[i:i] = [target]
                break
         num > target num target sorted_list[i:i] = [target] sorted_list[i:i] sorted_list i:i i i [target] target break sorted_list.append(target) sorted_list.append sorted_list append target target_list.pop(0) target_list.pop target_list pop 0 print(' '.join(str(s) for s in sorted_list + target_list)) print ' '.join(str(s) for s in sorted_list + target_list) ' '.join ' ' join str(s) str s target_list target_list N = int(input()) N int(input()) int input() input int(s) for s in input().split() for s in input().split() s input().split() ().split () input split for s in input().split() int(s) int s A = [int(s) for s in input().split()] A [int(s) for s in input().split()] insertion_sort(A) insertion_sort A N = int(input()) int(input()) N def insertion_sort(target_list):
    sorted_list = list()
    for target in target_list[:]:
        for i, num in enumerate(sorted_list):
            if num > target:
                sorted_list[i:i] = [target]
                break
        else:
            sorted_list.append(target)
        target_list.pop(0)
        print(' '.join(str(s) for s in sorted_list + target_list)) def insertion_sort(target_list):
    sorted_list = list()
    for target in target_list[:]:
        for i, num in enumerate(sorted_list):
            if num > target:
                sorted_list[i:i] = [target]
                break
        else:
            sorted_list.append(target)
        target_list.pop(0)
        print(' '.join(str(s) for s in sorted_list + target_list)) insertion_sort A = [int(s) for s in input().split()] [int(s) for s in input().split()] A
def insertion_sort(target_list):
    sorted_list = list()
    for target in target_list[:]:
        for i, num in enumerate(sorted_list):
            if num > target:
                sorted_list[i:i] = [target]
                break
        else:
            sorted_list.append(target)
        target_list.pop(0)
        print(' '.join(str(s) for s in sorted_list + target_list))

N = int(input())
A = [int(s) for s in input().split()]
insertion_sort(A)