import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;


class Main{

	static int len;
	static int[] arr;

	//メインメソッド
	public static void main(String[] args) throws IOException{
		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		int len = Integer.parseInt(reader.readLine());
		int[] arr = new int[len];
		//配列の要素数を1行目から読み取る

		String arrStr = reader.readLine();
        //2行目から配列の要素を読み取る
		StringTokenizer tokenizer = new StringTokenizer(arrStr," ");

		int i = 0;
		while(tokenizer.hasMoreElements()){
			arr[i++] = Integer.parseInt((String)tokenizer.nextElement());
		}
		reader.close();
        
        write(arr);
    
        
        //並べるメソッド
		sort(arr);
	}
	

	//引数は配列、返り値はなしでprintのみ。
	//ソートメソッド
	//printのタイミング・・？

	public static void sort(int[] arr){
        for(int i=1;i<arr.length;i++){
            int key = arr[i];
            int j = i-1;
            //System.out.println(arr[j]);
			while(j>=0 && arr[j]>key){
				int change = arr[j];
				arr[j]=key;
				arr[j+1]=change;
                j--;
			}
			write(arr);
		}
	}
	
	public static void write(int[] arr){
		for(int i=0;i<arr.length-1;i++){
			System.out.print(arr[i]+" ");
		}System.out.println(arr[arr.length-1]);
	}

} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io import java.util.StringTokenizer; StringTokenizer java.util class Main{

	static int len;
	static int[] arr;

	//メインメソッド
	public static void main(String[] args) throws IOException{
		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		int len = Integer.parseInt(reader.readLine());
		int[] arr = new int[len];
		//配列の要素数を1行目から読み取る

		String arrStr = reader.readLine();
        //2行目から配列の要素を読み取る
		StringTokenizer tokenizer = new StringTokenizer(arrStr," ");

		int i = 0;
		while(tokenizer.hasMoreElements()){
			arr[i++] = Integer.parseInt((String)tokenizer.nextElement());
		}
		reader.close();
        
        write(arr);
    
        
        //並べるメソッド
		sort(arr);
	}
	

	//引数は配列、返り値はなしでprintのみ。
	//ソートメソッド
	//printのタイミング・・？

	public static void sort(int[] arr){
        for(int i=1;i<arr.length;i++){
            int key = arr[i];
            int j = i-1;
            //System.out.println(arr[j]);
			while(j>=0 && arr[j]>key){
				int change = arr[j];
				arr[j]=key;
				arr[j+1]=change;
                j--;
			}
			write(arr);
		}
	}
	
	public static void write(int[] arr){
		for(int i=0;i<arr.length-1;i++){
			System.out.print(arr[i]+" ");
		}System.out.println(arr[arr.length-1]);
	}

} Main static int len; len static int[] arr; arr //メインメソッド
	public static void main(String[] args) throws IOException{
		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		int len = Integer.parseInt(reader.readLine());
		int[] arr = new int[len];
		//配列の要素数を1行目から読み取る

		String arrStr = reader.readLine();
        //2行目から配列の要素を読み取る
		StringTokenizer tokenizer = new StringTokenizer(arrStr," ");

		int i = 0;
		while(tokenizer.hasMoreElements()){
			arr[i++] = Integer.parseInt((String)tokenizer.nextElement());
		}
		reader.close();
        
        write(arr);
    
        
        //並べるメソッド
		sort(arr);
	} main {
		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		int len = Integer.parseInt(reader.readLine());
		int[] arr = new int[len];
		//配列の要素数を1行目から読み取る

		String arrStr = reader.readLine();
        //2行目から配列の要素を読み取る
		StringTokenizer tokenizer = new StringTokenizer(arrStr," ");

		int i = 0;
		while(tokenizer.hasMoreElements()){
			arr[i++] = Integer.parseInt((String)tokenizer.nextElement());
		}
		reader.close();
        
        write(arr);
    
        
        //並べるメソッド
		sort(arr);
	} BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); reader new BufferedReader(new InputStreamReader(System.in)) int len = Integer.parseInt(reader.readLine()); len Integer.parseInt(reader.readLine()) Integer.parseInt Integer reader.readLine() reader.readLine reader int[] arr = new int[len]; arr new int[len] len String arrStr = reader.readLine(); arrStr reader.readLine() reader.readLine reader StringTokenizer tokenizer = new StringTokenizer(arrStr," "); tokenizer new StringTokenizer(arrStr," ") int i = 0; i 0 while(tokenizer.hasMoreElements()){
			arr[i++] = Integer.parseInt((String)tokenizer.nextElement());
		} tokenizer.hasMoreElements() tokenizer.hasMoreElements tokenizer {
			arr[i++] = Integer.parseInt((String)tokenizer.nextElement());
		} arr[i++] = Integer.parseInt((String)tokenizer.nextElement()) arr[i++] arr i++ i Integer.parseInt((String)tokenizer.nextElement()) Integer.parseInt Integer (String)tokenizer.nextElement() tokenizer.nextElement tokenizer reader.close() reader.close reader write(arr) write arr sort(arr) sort arr String[] args args public static void sort(int[] arr){
        for(int i=1;i<arr.length;i++){
            int key = arr[i];
            int j = i-1;
            //System.out.println(arr[j]);
			while(j>=0 && arr[j]>key){
				int change = arr[j];
				arr[j]=key;
				arr[j+1]=change;
                j--;
			}
			write(arr);
		}
	} sort {
        for(int i=1;i<arr.length;i++){
            int key = arr[i];
            int j = i-1;
            //System.out.println(arr[j]);
			while(j>=0 && arr[j]>key){
				int change = arr[j];
				arr[j]=key;
				arr[j+1]=change;
                j--;
			}
			write(arr);
		}
	} for(int i=1;i<arr.length;i++){
            int key = arr[i];
            int j = i-1;
            //System.out.println(arr[j]);
			while(j>=0 && arr[j]>key){
				int change = arr[j];
				arr[j]=key;
				arr[j+1]=change;
                j--;
			}
			write(arr);
		} int i=1; int i=1; i 1 i<arr.length i arr.length arr arr.length i++ i++ i {
            int key = arr[i];
            int j = i-1;
            //System.out.println(arr[j]);
			while(j>=0 && arr[j]>key){
				int change = arr[j];
				arr[j]=key;
				arr[j+1]=change;
                j--;
			}
			write(arr);
		} {
            int key = arr[i];
            int j = i-1;
            //System.out.println(arr[j]);
			while(j>=0 && arr[j]>key){
				int change = arr[j];
				arr[j]=key;
				arr[j+1]=change;
                j--;
			}
			write(arr);
		} int key = arr[i]; key arr[i] arr i int j = i-1; j i-1 i 1 while(j>=0 && arr[j]>key){
				int change = arr[j];
				arr[j]=key;
				arr[j+1]=change;
                j--;
			} j>=0 && arr[j]>key j>=0 j 0 arr[j]>key arr[j] arr j key {
				int change = arr[j];
				arr[j]=key;
				arr[j+1]=change;
                j--;
			} int change = arr[j]; change arr[j] arr j arr[j]=key arr[j] arr j key arr[j+1]=change arr[j+1] arr j+1 j 1 change j-- j write(arr) write arr int[] arr arr public static void write(int[] arr){
		for(int i=0;i<arr.length-1;i++){
			System.out.print(arr[i]+" ");
		}System.out.println(arr[arr.length-1]);
	} write {
		for(int i=0;i<arr.length-1;i++){
			System.out.print(arr[i]+" ");
		}System.out.println(arr[arr.length-1]);
	} for(int i=0;i<arr.length-1;i++){
			System.out.print(arr[i]+" ");
		} int i=0; int i=0; i 0 i<arr.length-1 i arr.length-1 arr.length arr arr.length 1 i++ i++ i {
			System.out.print(arr[i]+" ");
		} {
			System.out.print(arr[i]+" ");
		} System.out.print(arr[i]+" ") System.out.print System.out System System.out arr[i]+" " arr[i] arr i " " System.out.println(arr[arr.length-1]) System.out.println System.out System System.out arr[arr.length-1] arr arr.length-1 arr.length arr arr.length 1 int[] arr arr
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;


class Main{

	static int len;
	static int[] arr;

	//メインメソッド
	public static void main(String[] args) throws IOException{
		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		int len = Integer.parseInt(reader.readLine());
		int[] arr = new int[len];
		//配列の要素数を1行目から読み取る

		String arrStr = reader.readLine();
        //2行目から配列の要素を読み取る
		StringTokenizer tokenizer = new StringTokenizer(arrStr," ");

		int i = 0;
		while(tokenizer.hasMoreElements()){
			arr[i++] = Integer.parseInt((String)tokenizer.nextElement());
		}
		reader.close();
        
        write(arr);
    
        
        //並べるメソッド
		sort(arr);
	}
	

	//引数は配列、返り値はなしでprintのみ。
	//ソートメソッド
	//printのタイミング・・？

	public static void sort(int[] arr){
        for(int i=1;i<arr.length;i++){
            int key = arr[i];
            int j = i-1;
            //System.out.println(arr[j]);
			while(j>=0 && arr[j]>key){
				int change = arr[j];
				arr[j]=key;
				arr[j+1]=change;
                j--;
			}
			write(arr);
		}
	}
	
	public static void write(int[] arr){
		for(int i=0;i<arr.length-1;i++){
			System.out.print(arr[i]+" ");
		}System.out.println(arr[arr.length-1]);
	}

}