import copy

def insertion_sort(List):
	l=len(List)
	for i in range(l):
		for j in range(i):
			if List[i]<List[j]:
				temp=copy.copy(List)
				for k in range(j,i):
					List[k+1]=temp[k]
				List[j]=temp[i]
				break
		print(" ".join(map(str,List)))

N=input()
N_List=map(int,raw_input().split())
insertion_sort(N_List) import copy copy def insertion_sort(List):
	l=len(List)
	for i in range(l):
		for j in range(i):
			if List[i]<List[j]:
				temp=copy.copy(List)
				for k in range(j,i):
					List[k+1]=temp[k]
				List[j]=temp[i]
				break
		print(" ".join(map(str,List))) insertion_sort l=len(List) l len(List) len List for i in range(l):
		for j in range(i):
			if List[i]<List[j]:
				temp=copy.copy(List)
				for k in range(j,i):
					List[k+1]=temp[k]
				List[j]=temp[i]
				break
		print(" ".join(map(str,List))) i range(l) range l for j in range(i):
			if List[i]<List[j]:
				temp=copy.copy(List)
				for k in range(j,i):
					List[k+1]=temp[k]
				List[j]=temp[i]
				break
		 j range(i) range i if List[i]<List[j]:
				temp=copy.copy(List)
				for k in range(j,i):
					List[k+1]=temp[k]
				List[j]=temp[i]
				break
		 List[i]<List[j] List[i] List i List[j] List j temp=copy.copy(List) temp copy.copy(List) copy.copy copy copy List for k in range(j,i):
					List[k+1]=temp[k]
				 k range(j,i) range j i List[k+1]=temp[k] List[k+1] List k+1 k 1 temp[k] temp k List[j]=temp[i] List[j] List j temp[i] temp i break print(" ".join(map(str,List))) print " ".join(map(str,List)) " ".join " " join map(str,List) map str List List List N=input() N input() input N_List=map(int,raw_input().split()) N_List map(int,raw_input().split()) map int raw_input().split() ().split () raw_input split insertion_sort(N_List) insertion_sort N_List N=input() input() N def insertion_sort(List):
	l=len(List)
	for i in range(l):
		for j in range(i):
			if List[i]<List[j]:
				temp=copy.copy(List)
				for k in range(j,i):
					List[k+1]=temp[k]
				List[j]=temp[i]
				break
		print(" ".join(map(str,List))) def insertion_sort(List):
	l=len(List)
	for i in range(l):
		for j in range(i):
			if List[i]<List[j]:
				temp=copy.copy(List)
				for k in range(j,i):
					List[k+1]=temp[k]
				List[j]=temp[i]
				break
		print(" ".join(map(str,List))) insertion_sort N_List=map(int,raw_input().split()) map(int,raw_input().split()) N_List
import copy

def insertion_sort(List):
	l=len(List)
	for i in range(l):
		for j in range(i):
			if List[i]<List[j]:
				temp=copy.copy(List)
				for k in range(j,i):
					List[k+1]=temp[k]
				List[j]=temp[i]
				break
		print(" ".join(map(str,List)))

N=input()
N_List=map(int,raw_input().split())
insertion_sort(N_List)