def main():
    number = int(raw_input())
    list = map(int, raw_input().split())
    sort(number, list)

def sort(number, list):
    output(list)
    for i in range(1, number):
        key = list[i]
        j = i - 1
        while j >= 0 and list[j] > key:
            list[j+1] = list[j]
            j -= 1
        list[j+1] = key
        output(list)

def output(list):
    print(" ".join(map(str, list)))

main() def main():
    number = int(raw_input())
    list = map(int, raw_input().split())
    sort(number, list) main number = int(raw_input()) number int(raw_input()) int raw_input() raw_input list = map(int, raw_input().split()) list map(int, raw_input().split()) map int raw_input().split() ().split () raw_input split sort(number, list) sort number list def sort(number, list):
    output(list)
    for i in range(1, number):
        key = list[i]
        j = i - 1
        while j >= 0 and list[j] > key:
            list[j+1] = list[j]
            j -= 1
        list[j+1] = key
        output(list) sort output(list) output list for i in range(1, number):
        key = list[i]
        j = i - 1
        while j >= 0 and list[j] > key:
            list[j+1] = list[j]
            j -= 1
        list[j+1] = key
        output(list) i range(1, number) range 1 number key = list[i] key list[i] list i j = i - 1 j i - 1 i 1 while j >= 0 and list[j] > key:
            list[j+1] = list[j]
            j -= 1
         j >= 0 and list[j] > key j >= 0 j 0 list[j] > key list[j] list j key list[j+1] = list[j] list[j+1] list j+1 j 1 list[j] list j j -= 1 j 1 list[j+1] = key list[j+1] list j+1 j 1 key output(list) output list number number list list def output(list):
    print(" ".join(map(str, list))) output print(" ".join(map(str, list))) print " ".join(map(str, list)) " ".join " " join map(str, list) map str list list list main() main def main():
    number = int(raw_input())
    list = map(int, raw_input().split())
    sort(number, list) def main():
    number = int(raw_input())
    list = map(int, raw_input().split())
    sort(number, list) main def sort(number, list):
    output(list)
    for i in range(1, number):
        key = list[i]
        j = i - 1
        while j >= 0 and list[j] > key:
            list[j+1] = list[j]
            j -= 1
        list[j+1] = key
        output(list) def sort(number, list):
    output(list)
    for i in range(1, number):
        key = list[i]
        j = i - 1
        while j >= 0 and list[j] > key:
            list[j+1] = list[j]
            j -= 1
        list[j+1] = key
        output(list) sort def output(list):
    print(" ".join(map(str, list))) def output(list):
    print(" ".join(map(str, list))) output
def main():
    number = int(raw_input())
    list = map(int, raw_input().split())
    sort(number, list)

def sort(number, list):
    output(list)
    for i in range(1, number):
        key = list[i]
        j = i - 1
        while j >= 0 and list[j] > key:
            list[j+1] = list[j]
            j -= 1
        list[j+1] = key
        output(list)

def output(list):
    print(" ".join(map(str, list)))

main()