import sys

lines = sys.stdin.readlines()

N = lines[0]
A = lines[1].strip().split(" ")

print " ".join(A)

for i in range(1, len(A)):
    key = A[i]
    j = i - 1
    while j >= 0 and int(A[j]) > int(key):
        A[j+1] = A[j]
        j -= 1
    A[j+1] = key
    print " ".join(A) import sys sys lines = sys.stdin.readlines() lines sys.stdin.readlines() sys.stdin.readlines sys.stdin sys stdin readlines N = lines[0] N lines[0] lines 0 A = lines[1].strip().split(" ") A lines[1].strip().split(" ") [1].strip().split [1].strip() [1].strip [1] lines 1 strip split " " print " ".join(A) " ".join " " join A for i in range(1, len(A)):
    key = A[i]
    j = i - 1
    while j >= 0 and int(A[j]) > int(key):
        A[j+1] = A[j]
        j -= 1
    A[j+1] = key
    print " ".join(A) i range(1, len(A)) range 1 len(A) len A key = A[i] key A[i] A i j = i - 1 j i - 1 i 1 while j >= 0 and int(A[j]) > int(key):
        A[j+1] = A[j]
        j -= 1
     j >= 0 and int(A[j]) > int(key) j >= 0 j 0 int(A[j]) > int(key) int(A[j]) int A[j] A j int(key) int key A[j+1] = A[j] A[j+1] A j+1 j 1 A[j] A j j -= 1 j 1 A[j+1] = key A[j+1] A j+1 j 1 key print " ".join(A) " ".join " " join A N = lines[0] lines[0] N key = A[i] A[i] key j = i - 1 i - 1 j lines = sys.stdin.readlines() sys.stdin.readlines() lines A = lines[1].strip().split(" ") lines[1].strip().split(" ") A j -= 1 1 j
import sys

lines = sys.stdin.readlines()

N = lines[0]
A = lines[1].strip().split(" ")

print " ".join(A)

for i in range(1, len(A)):
    key = A[i]
    j = i - 1
    while j >= 0 and int(A[j]) > int(key):
        A[j+1] = A[j]
        j -= 1
    A[j+1] = key
    print " ".join(A)