n = input()
data = [int(i) for i in input().split(' ')]

def insertion_sort(raw_list):
    for i, v in enumerate(raw_list):
        if i == 0:
            continue
        j = i - 1
        while j >= 0 and v < raw_list[j]:
            raw_list[j+1] = v 
            raw_list[j+1] = raw_list[j]
            j -= 1
        raw_list[j+1] = v 
        print(' '.join([str(i) for i in raw_list]))

    return raw_list

print(' '.join([str(i) for i in data]))
insertion_sort(data)
#print(' '.join([str(i) for i in insertion_sort(data)])) n = input() n input() input int(i) for i in input().split(' ') for i in input().split(' ') i input().split(' ') ().split () input split ' ' for i in input().split(' ') int(i) int i data = [int(i) for i in input().split(' ')] data [int(i) for i in input().split(' ')] def insertion_sort(raw_list):
    for i, v in enumerate(raw_list):
        if i == 0:
            continue
        j = i - 1
        while j >= 0 and v < raw_list[j]:
            raw_list[j+1] = v 
            raw_list[j+1] = raw_list[j]
            j -= 1
        raw_list[j+1] = v 
        print(' '.join([str(i) for i in raw_list]))

    return raw_list insertion_sort for i, v in enumerate(raw_list):
        if i == 0:
            continue
        j = i - 1
        while j >= 0 and v < raw_list[j]:
            raw_list[j+1] = v 
            raw_list[j+1] = raw_list[j]
            j -= 1
        raw_list[j+1] = v 
        print(' '.join([str(i) for i in raw_list]))

     i v enumerate(raw_list) enumerate raw_list if i == 0:
            continue
         i == 0 i 0 continue j = i - 1 j i - 1 i 1 while j >= 0 and v < raw_list[j]:
            raw_list[j+1] = v 
            raw_list[j+1] = raw_list[j]
            j -= 1
         j >= 0 and v < raw_list[j] j >= 0 j 0 v < raw_list[j] v raw_list[j] raw_list j raw_list[j+1] = v raw_list[j+1] raw_list j+1 j 1 v raw_list[j+1] = raw_list[j] raw_list[j+1] raw_list j+1 j 1 raw_list[j] raw_list j j -= 1 j 1 raw_list[j+1] = v raw_list[j+1] raw_list j+1 j 1 v str(i) for i in raw_list for i in raw_list i raw_list for i in raw_list str(i) str i print(' '.join([str(i) for i in raw_list])) print ' '.join([str(i) for i in raw_list]) ' '.join ' ' join [str(i) for i in raw_list] return raw_list raw_list raw_list raw_list str(i) for i in data for i in data i data for i in data str(i) str i print(' '.join([str(i) for i in data])) print ' '.join([str(i) for i in data]) ' '.join ' ' join [str(i) for i in data] insertion_sort(data) insertion_sort data n = input() input() n def insertion_sort(raw_list):
    for i, v in enumerate(raw_list):
        if i == 0:
            continue
        j = i - 1
        while j >= 0 and v < raw_list[j]:
            raw_list[j+1] = v 
            raw_list[j+1] = raw_list[j]
            j -= 1
        raw_list[j+1] = v 
        print(' '.join([str(i) for i in raw_list]))

    return raw_list def insertion_sort(raw_list):
    for i, v in enumerate(raw_list):
        if i == 0:
            continue
        j = i - 1
        while j >= 0 and v < raw_list[j]:
            raw_list[j+1] = v 
            raw_list[j+1] = raw_list[j]
            j -= 1
        raw_list[j+1] = v 
        print(' '.join([str(i) for i in raw_list]))

    return raw_list insertion_sort data = [int(i) for i in input().split(' ')] [int(i) for i in input().split(' ')] data
n = input()
data = [int(i) for i in input().split(' ')]

def insertion_sort(raw_list):
    for i, v in enumerate(raw_list):
        if i == 0:
            continue
        j = i - 1
        while j >= 0 and v < raw_list[j]:
            raw_list[j+1] = v 
            raw_list[j+1] = raw_list[j]
            j -= 1
        raw_list[j+1] = v 
        print(' '.join([str(i) for i in raw_list]))

    return raw_list

print(' '.join([str(i) for i in data]))
insertion_sort(data)
#print(' '.join([str(i) for i in insertion_sort(data)]))