//Getting Started - Insertion Sort
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

class Main {

	public static void main(String[] args) throws IOException {

		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));

		 int n =Integer.parseInt(in.readLine());

		 String[] data = in.readLine().split(" ");

//		 int n =6;
//		 String[] data = "5 2 4 6 1 3".split(" ");

		 
		 int[] A = new int[n];
		 
		 for(int i=0;i<n;i++){
			 A[i]=Integer.parseInt(data[i]);
		 }
		 
		 
		 System.out.print(A[0]); 
		 for(int k=1;k<n;k++){
			 System.out.print(" " + A[k]);
		 }
		 System.out.println(); 
		 
		 for(int i=1;i<n;i++){

			 int v= A[i];
			 
			 int j=i-1;
			 
			 while( j>=0&&A[j]>v){
				 
				 A[j+1]=A[j];
				 j--;
			 }
			 A[j+1]=v;
			 
			 System.out.print(A[0]); 
			 for(int k=1;k<n;k++){
				 System.out.print(" " + A[k]);
			 }
			 System.out.println(); 
		 }
		 
	}
} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io class Main {

	public static void main(String[] args) throws IOException {

		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));

		 int n =Integer.parseInt(in.readLine());

		 String[] data = in.readLine().split(" ");

//		 int n =6;
//		 String[] data = "5 2 4 6 1 3".split(" ");

		 
		 int[] A = new int[n];
		 
		 for(int i=0;i<n;i++){
			 A[i]=Integer.parseInt(data[i]);
		 }
		 
		 
		 System.out.print(A[0]); 
		 for(int k=1;k<n;k++){
			 System.out.print(" " + A[k]);
		 }
		 System.out.println(); 
		 
		 for(int i=1;i<n;i++){

			 int v= A[i];
			 
			 int j=i-1;
			 
			 while( j>=0&&A[j]>v){
				 
				 A[j+1]=A[j];
				 j--;
			 }
			 A[j+1]=v;
			 
			 System.out.print(A[0]); 
			 for(int k=1;k<n;k++){
				 System.out.print(" " + A[k]);
			 }
			 System.out.println(); 
		 }
		 
	}
} Main public static void main(String[] args) throws IOException {

		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));

		 int n =Integer.parseInt(in.readLine());

		 String[] data = in.readLine().split(" ");

//		 int n =6;
//		 String[] data = "5 2 4 6 1 3".split(" ");

		 
		 int[] A = new int[n];
		 
		 for(int i=0;i<n;i++){
			 A[i]=Integer.parseInt(data[i]);
		 }
		 
		 
		 System.out.print(A[0]); 
		 for(int k=1;k<n;k++){
			 System.out.print(" " + A[k]);
		 }
		 System.out.println(); 
		 
		 for(int i=1;i<n;i++){

			 int v= A[i];
			 
			 int j=i-1;
			 
			 while( j>=0&&A[j]>v){
				 
				 A[j+1]=A[j];
				 j--;
			 }
			 A[j+1]=v;
			 
			 System.out.print(A[0]); 
			 for(int k=1;k<n;k++){
				 System.out.print(" " + A[k]);
			 }
			 System.out.println(); 
		 }
		 
	} main {

		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));

		 int n =Integer.parseInt(in.readLine());

		 String[] data = in.readLine().split(" ");

//		 int n =6;
//		 String[] data = "5 2 4 6 1 3".split(" ");

		 
		 int[] A = new int[n];
		 
		 for(int i=0;i<n;i++){
			 A[i]=Integer.parseInt(data[i]);
		 }
		 
		 
		 System.out.print(A[0]); 
		 for(int k=1;k<n;k++){
			 System.out.print(" " + A[k]);
		 }
		 System.out.println(); 
		 
		 for(int i=1;i<n;i++){

			 int v= A[i];
			 
			 int j=i-1;
			 
			 while( j>=0&&A[j]>v){
				 
				 A[j+1]=A[j];
				 j--;
			 }
			 A[j+1]=v;
			 
			 System.out.print(A[0]); 
			 for(int k=1;k<n;k++){
				 System.out.print(" " + A[k]);
			 }
			 System.out.println(); 
		 }
		 
	} BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); in new BufferedReader(new InputStreamReader(System.in)) int n =Integer.parseInt(in.readLine()); n Integer.parseInt(in.readLine()) Integer.parseInt Integer in.readLine() in.readLine in String[] data = in.readLine().split(" "); data in.readLine().split(" ") in.readLine().split in.readLine() in.readLine in " " int[] A = new int[n]; A new int[n] n for(int i=0;i<n;i++){
			 A[i]=Integer.parseInt(data[i]);
		 } int i=0; int i=0; i 0 i<n i n i++ i++ i {
			 A[i]=Integer.parseInt(data[i]);
		 } {
			 A[i]=Integer.parseInt(data[i]);
		 } A[i]=Integer.parseInt(data[i]) A[i] A i Integer.parseInt(data[i]) Integer.parseInt Integer data[i] data i System.out.print(A[0]) System.out.print System.out System System.out A[0] A 0 for(int k=1;k<n;k++){
			 System.out.print(" " + A[k]);
		 } int k=1; int k=1; k 1 k<n k n k++ k++ k {
			 System.out.print(" " + A[k]);
		 } {
			 System.out.print(" " + A[k]);
		 } System.out.print(" " + A[k]) System.out.print System.out System System.out " " + A[k] " " A[k] A k System.out.println() System.out.println System.out System System.out for(int i=1;i<n;i++){

			 int v= A[i];
			 
			 int j=i-1;
			 
			 while( j>=0&&A[j]>v){
				 
				 A[j+1]=A[j];
				 j--;
			 }
			 A[j+1]=v;
			 
			 System.out.print(A[0]); 
			 for(int k=1;k<n;k++){
				 System.out.print(" " + A[k]);
			 }
			 System.out.println(); 
		 } int i=1; int i=1; i 1 i<n i n i++ i++ i {

			 int v= A[i];
			 
			 int j=i-1;
			 
			 while( j>=0&&A[j]>v){
				 
				 A[j+1]=A[j];
				 j--;
			 }
			 A[j+1]=v;
			 
			 System.out.print(A[0]); 
			 for(int k=1;k<n;k++){
				 System.out.print(" " + A[k]);
			 }
			 System.out.println(); 
		 } {

			 int v= A[i];
			 
			 int j=i-1;
			 
			 while( j>=0&&A[j]>v){
				 
				 A[j+1]=A[j];
				 j--;
			 }
			 A[j+1]=v;
			 
			 System.out.print(A[0]); 
			 for(int k=1;k<n;k++){
				 System.out.print(" " + A[k]);
			 }
			 System.out.println(); 
		 } int v= A[i]; v A[i] A i int j=i-1; j i-1 i 1 while( j>=0&&A[j]>v){
				 
				 A[j+1]=A[j];
				 j--;
			 } j>=0&&A[j]>v j>=0 j 0 A[j]>v A[j] A j v {
				 
				 A[j+1]=A[j];
				 j--;
			 } A[j+1]=A[j] A[j+1] A j+1 j 1 A[j] A j j-- j A[j+1]=v A[j+1] A j+1 j 1 v System.out.print(A[0]) System.out.print System.out System System.out A[0] A 0 for(int k=1;k<n;k++){
				 System.out.print(" " + A[k]);
			 } int k=1; int k=1; k 1 k<n k n k++ k++ k {
				 System.out.print(" " + A[k]);
			 } {
				 System.out.print(" " + A[k]);
			 } System.out.print(" " + A[k]) System.out.print System.out System System.out " " + A[k] " " A[k] A k System.out.println() System.out.println System.out System System.out String[] args args
//Getting Started - Insertion Sort
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

class Main {

	public static void main(String[] args) throws IOException {

		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));

		 int n =Integer.parseInt(in.readLine());

		 String[] data = in.readLine().split(" ");

//		 int n =6;
//		 String[] data = "5 2 4 6 1 3".split(" ");

		 
		 int[] A = new int[n];
		 
		 for(int i=0;i<n;i++){
			 A[i]=Integer.parseInt(data[i]);
		 }
		 
		 
		 System.out.print(A[0]); 
		 for(int k=1;k<n;k++){
			 System.out.print(" " + A[k]);
		 }
		 System.out.println(); 
		 
		 for(int i=1;i<n;i++){

			 int v= A[i];
			 
			 int j=i-1;
			 
			 while( j>=0&&A[j]>v){
				 
				 A[j+1]=A[j];
				 j--;
			 }
			 A[j+1]=v;
			 
			 System.out.print(A[0]); 
			 for(int k=1;k<n;k++){
				 System.out.print(" " + A[k]);
			 }
			 System.out.println(); 
		 }
		 
	}
}