import java.util.Scanner;

public class Main{
	public static void main(String[] args)
	{
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] ar = new int[n];
		for(int i=0 ; i<n ; i++ )
		{
			ar[i] = sc.nextInt();
		}
		printAr(ar,-1);
		for(int j = 1; j < n ;j++)
		{
			int tar = ar[j];
			int k = j;
			while(k > 0 && tar < ar[k-1])
			{
				ar[k] = ar[k-1];
				k--;
				ar[k] = tar;
			}
			printAr(ar,j);
			
			
		}
	}
	public static void printAr(int[] a,int c){
		int i;
		for(i = 0 ; i < a.length-1 ; i++){
			System.out.print(a[i]+" ");
		}
			System.out.println(a[i]);	
	}
	
}
 

  import java.util.Scanner; Scanner java.util public class Main{
	public static void main(String[] args)
	{
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] ar = new int[n];
		for(int i=0 ; i<n ; i++ )
		{
			ar[i] = sc.nextInt();
		}
		printAr(ar,-1);
		for(int j = 1; j < n ;j++)
		{
			int tar = ar[j];
			int k = j;
			while(k > 0 && tar < ar[k-1])
			{
				ar[k] = ar[k-1];
				k--;
				ar[k] = tar;
			}
			printAr(ar,j);
			
			
		}
	}
	public static void printAr(int[] a,int c){
		int i;
		for(i = 0 ; i < a.length-1 ; i++){
			System.out.print(a[i]+" ");
		}
			System.out.println(a[i]);	
	}
	
} Main public static void main(String[] args)
	{
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] ar = new int[n];
		for(int i=0 ; i<n ; i++ )
		{
			ar[i] = sc.nextInt();
		}
		printAr(ar,-1);
		for(int j = 1; j < n ;j++)
		{
			int tar = ar[j];
			int k = j;
			while(k > 0 && tar < ar[k-1])
			{
				ar[k] = ar[k-1];
				k--;
				ar[k] = tar;
			}
			printAr(ar,j);
			
			
		}
	} main {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] ar = new int[n];
		for(int i=0 ; i<n ; i++ )
		{
			ar[i] = sc.nextInt();
		}
		printAr(ar,-1);
		for(int j = 1; j < n ;j++)
		{
			int tar = ar[j];
			int k = j;
			while(k > 0 && tar < ar[k-1])
			{
				ar[k] = ar[k-1];
				k--;
				ar[k] = tar;
			}
			printAr(ar,j);
			
			
		}
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int[] ar = new int[n]; ar new int[n] n for(int i=0 ; i<n ; i++ )
		{
			ar[i] = sc.nextInt();
		} int i=0 ; int i=0 ; i 0 i<n i n i++ i++ i {
			ar[i] = sc.nextInt();
		} {
			ar[i] = sc.nextInt();
		} ar[i] = sc.nextInt() ar[i] ar i sc.nextInt() sc.nextInt sc printAr(ar,-1) printAr ar -1 1 for(int j = 1; j < n ;j++)
		{
			int tar = ar[j];
			int k = j;
			while(k > 0 && tar < ar[k-1])
			{
				ar[k] = ar[k-1];
				k--;
				ar[k] = tar;
			}
			printAr(ar,j);
			
			
		} int j = 1; int j = 1; j 1 j < n j n j++ j++ j {
			int tar = ar[j];
			int k = j;
			while(k > 0 && tar < ar[k-1])
			{
				ar[k] = ar[k-1];
				k--;
				ar[k] = tar;
			}
			printAr(ar,j);
			
			
		} {
			int tar = ar[j];
			int k = j;
			while(k > 0 && tar < ar[k-1])
			{
				ar[k] = ar[k-1];
				k--;
				ar[k] = tar;
			}
			printAr(ar,j);
			
			
		} int tar = ar[j]; tar ar[j] ar j int k = j; k j while(k > 0 && tar < ar[k-1])
			{
				ar[k] = ar[k-1];
				k--;
				ar[k] = tar;
			} k > 0 && tar < ar[k-1] k > 0 k 0 tar < ar[k-1] tar ar[k-1] ar k-1 k 1 {
				ar[k] = ar[k-1];
				k--;
				ar[k] = tar;
			} ar[k] = ar[k-1] ar[k] ar k ar[k-1] ar k-1 k 1 k-- k ar[k] = tar ar[k] ar k tar printAr(ar,j) printAr ar j String[] args args public static void printAr(int[] a,int c){
		int i;
		for(i = 0 ; i < a.length-1 ; i++){
			System.out.print(a[i]+" ");
		}
			System.out.println(a[i]);	
	} printAr {
		int i;
		for(i = 0 ; i < a.length-1 ; i++){
			System.out.print(a[i]+" ");
		}
			System.out.println(a[i]);	
	} int i; i for(i = 0 ; i < a.length-1 ; i++){
			System.out.print(a[i]+" ");
		} i = 0 ; i = 0 i 0 i < a.length-1 i a.length-1 a.length a a.length 1 i++ i++ i {
			System.out.print(a[i]+" ");
		} {
			System.out.print(a[i]+" ");
		} System.out.print(a[i]+" ") System.out.print System.out System System.out a[i]+" " a[i] a i " " System.out.println(a[i]) System.out.println System.out System System.out a[i] a i int[] a a int c c public class Main{
	public static void main(String[] args)
	{
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] ar = new int[n];
		for(int i=0 ; i<n ; i++ )
		{
			ar[i] = sc.nextInt();
		}
		printAr(ar,-1);
		for(int j = 1; j < n ;j++)
		{
			int tar = ar[j];
			int k = j;
			while(k > 0 && tar < ar[k-1])
			{
				ar[k] = ar[k-1];
				k--;
				ar[k] = tar;
			}
			printAr(ar,j);
			
			
		}
	}
	public static void printAr(int[] a,int c){
		int i;
		for(i = 0 ; i < a.length-1 ; i++){
			System.out.print(a[i]+" ");
		}
			System.out.println(a[i]);	
	}
	
} public class Main{
	public static void main(String[] args)
	{
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] ar = new int[n];
		for(int i=0 ; i<n ; i++ )
		{
			ar[i] = sc.nextInt();
		}
		printAr(ar,-1);
		for(int j = 1; j < n ;j++)
		{
			int tar = ar[j];
			int k = j;
			while(k > 0 && tar < ar[k-1])
			{
				ar[k] = ar[k-1];
				k--;
				ar[k] = tar;
			}
			printAr(ar,j);
			
			
		}
	}
	public static void printAr(int[] a,int c){
		int i;
		for(i = 0 ; i < a.length-1 ; i++){
			System.out.print(a[i]+" ");
		}
			System.out.println(a[i]);	
	}
	
} Main
import java.util.Scanner;

public class Main{
	public static void main(String[] args)
	{
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] ar = new int[n];
		for(int i=0 ; i<n ; i++ )
		{
			ar[i] = sc.nextInt();
		}
		printAr(ar,-1);
		for(int j = 1; j < n ;j++)
		{
			int tar = ar[j];
			int k = j;
			while(k > 0 && tar < ar[k-1])
			{
				ar[k] = ar[k-1];
				k--;
				ar[k] = tar;
			}
			printAr(ar,j);
			
			
		}
	}
	public static void printAr(int[] a,int c){
		int i;
		for(i = 0 ; i < a.length-1 ; i++){
			System.out.print(a[i]+" ");
		}
			System.out.println(a[i]);	
	}
	
}
 

 