//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(); 
		 }
		 
	}
}
/tmp/hf-datasets-cache/medium/datasets/42704881117311-config-parquet-and-info-qiankunmu-Project_CodeNet-896c9d36/hub/datasets--qiankunmu--Project_CodeNet_Python800_and_Java250/snapshots/c899fde44a77ba1cc14973ed3de064e4ff3aadc7/Project_CodeNet_Java250.tar.gz