import sys

def display(inp):
    s = len(inp)
    for i in range(s):
        if i!=len(inp)-1:
            print("%d" % inp[i], end=" ")
        else:
            print("%d" % inp[i], end="")
    print("")

line = sys.stdin.readline()
size = int(line)
line = sys.stdin.readline()
inp = []
for i in line.split(" "):
    inp.append(int(i))

display(inp)

for i in range(1,size):
    if inp[i]!=size:
        check = inp.pop(i)
        for j in range(i):
            if check<inp[j]:
                inp.insert(j,check)
                break
            if j==i-1:
                inp.insert(j+1,check)
                break
    display(inp) import sys sys def display(inp):
    s = len(inp)
    for i in range(s):
        if i!=len(inp)-1:
            print("%d" % inp[i], end=" ")
        else:
            print("%d" % inp[i], end="")
    print("") display s = len(inp) s len(inp) len inp for i in range(s):
        if i!=len(inp)-1:
            print("%d" % inp[i], end=" ")
        else:
            print("%d" % inp[i], end="")
     i range(s) range s if i!=len(inp)-1:
            print("%d" % inp[i], end=" ")
        else:
            print("%d" % inp[i], end="")
     i!=len(inp)-1 i len(inp)-1 len(inp) len inp 1 print("%d" % inp[i], end=" ") print "%d" % inp[i] "%d" inp[i] inp i end=" " end " " print("%d" % inp[i], end="") print "%d" % inp[i] "%d" inp[i] inp i end="" end "" print("") print "" inp inp line = sys.stdin.readline() line sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline size = int(line) size int(line) int line line = sys.stdin.readline() line sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline inp = [] inp [] for i in line.split(" "):
    inp.append(int(i)) i line.split(" ") line.split line split " " inp.append(int(i)) inp.append inp append int(i) int i display(inp) display inp for i in range(1,size):
    if inp[i]!=size:
        check = inp.pop(i)
        for j in range(i):
            if check<inp[j]:
                inp.insert(j,check)
                break
            if j==i-1:
                inp.insert(j+1,check)
                break
    display(inp) i range(1,size) range 1 size if inp[i]!=size:
        check = inp.pop(i)
        for j in range(i):
            if check<inp[j]:
                inp.insert(j,check)
                break
            if j==i-1:
                inp.insert(j+1,check)
                break
     inp[i]!=size inp[i] inp i size check = inp.pop(i) check inp.pop(i) inp.pop inp pop i for j in range(i):
            if check<inp[j]:
                inp.insert(j,check)
                break
            if j==i-1:
                inp.insert(j+1,check)
                break
     j range(i) range i if check<inp[j]:
                inp.insert(j,check)
                break
             check<inp[j] check inp[j] inp j inp.insert(j,check) inp.insert inp insert j check break if j==i-1:
                inp.insert(j+1,check)
                break
     j==i-1 j i-1 i 1 inp.insert(j+1,check) inp.insert inp insert j+1 j 1 check break display(inp) display inp check = inp.pop(i) inp.pop(i) check def display(inp):
    s = len(inp)
    for i in range(s):
        if i!=len(inp)-1:
            print("%d" % inp[i], end=" ")
        else:
            print("%d" % inp[i], end="")
    print("") def display(inp):
    s = len(inp)
    for i in range(s):
        if i!=len(inp)-1:
            print("%d" % inp[i], end=" ")
        else:
            print("%d" % inp[i], end="")
    print("") display line = sys.stdin.readline() sys.stdin.readline() line line = sys.stdin.readline() sys.stdin.readline() line inp = [] [] inp size = int(line) int(line) size
import sys

def display(inp):
    s = len(inp)
    for i in range(s):
        if i!=len(inp)-1:
            print("%d" % inp[i], end=" ")
        else:
            print("%d" % inp[i], end="")
    print("")

line = sys.stdin.readline()
size = int(line)
line = sys.stdin.readline()
inp = []
for i in line.split(" "):
    inp.append(int(i))

display(inp)

for i in range(1,size):
    if inp[i]!=size:
        check = inp.pop(i)
        for j in range(i):
            if check<inp[j]:
                inp.insert(j,check)
                break
            if j==i-1:
                inp.insert(j+1,check)
                break
    display(inp)