import java.util.*;

public class Main{
	private static final Scanner scan = new Scanner(System.in);

	public static void main(String[] args){

		int N = scan.nextInt();
		int[] arr = new int[N];
		for(int i = 0; i < N; i++){
			int num = scan.nextInt();
			arr[i] = num;
		}
		
		for(int i = 0; i < N; i++){
			if(i != N - 1){
				System.out.printf("%d ", arr[i]);
			} else{
				System.out.printf("%d\n", arr[i]);
			}
		}

		for(int i = 1; i < N; i++){
			int v = arr[i];
			int j = i - 1;
			while(j >= 0 && arr[j] > v){
				arr[j + 1] = arr[j];
				j--;
				arr[j + 1] = v;
			}
			for(int k = 0; k < N; k++){
				if(k != N - 1){
					System.out.printf("%d ", arr[k]);
				} else{
					System.out.printf("%d\n", arr[k]);
				}
			}
		}
	}
} import java.util.*; util.* java public class Main{
	private static final Scanner scan = new Scanner(System.in);

	public static void main(String[] args){

		int N = scan.nextInt();
		int[] arr = new int[N];
		for(int i = 0; i < N; i++){
			int num = scan.nextInt();
			arr[i] = num;
		}
		
		for(int i = 0; i < N; i++){
			if(i != N - 1){
				System.out.printf("%d ", arr[i]);
			} else{
				System.out.printf("%d\n", arr[i]);
			}
		}

		for(int i = 1; i < N; i++){
			int v = arr[i];
			int j = i - 1;
			while(j >= 0 && arr[j] > v){
				arr[j + 1] = arr[j];
				j--;
				arr[j + 1] = v;
			}
			for(int k = 0; k < N; k++){
				if(k != N - 1){
					System.out.printf("%d ", arr[k]);
				} else{
					System.out.printf("%d\n", arr[k]);
				}
			}
		}
	}
} Main private static final Scanner scan = new Scanner(System.in); scan new Scanner(System.in) public static void main(String[] args){

		int N = scan.nextInt();
		int[] arr = new int[N];
		for(int i = 0; i < N; i++){
			int num = scan.nextInt();
			arr[i] = num;
		}
		
		for(int i = 0; i < N; i++){
			if(i != N - 1){
				System.out.printf("%d ", arr[i]);
			} else{
				System.out.printf("%d\n", arr[i]);
			}
		}

		for(int i = 1; i < N; i++){
			int v = arr[i];
			int j = i - 1;
			while(j >= 0 && arr[j] > v){
				arr[j + 1] = arr[j];
				j--;
				arr[j + 1] = v;
			}
			for(int k = 0; k < N; k++){
				if(k != N - 1){
					System.out.printf("%d ", arr[k]);
				} else{
					System.out.printf("%d\n", arr[k]);
				}
			}
		}
	} main {

		int N = scan.nextInt();
		int[] arr = new int[N];
		for(int i = 0; i < N; i++){
			int num = scan.nextInt();
			arr[i] = num;
		}
		
		for(int i = 0; i < N; i++){
			if(i != N - 1){
				System.out.printf("%d ", arr[i]);
			} else{
				System.out.printf("%d\n", arr[i]);
			}
		}

		for(int i = 1; i < N; i++){
			int v = arr[i];
			int j = i - 1;
			while(j >= 0 && arr[j] > v){
				arr[j + 1] = arr[j];
				j--;
				arr[j + 1] = v;
			}
			for(int k = 0; k < N; k++){
				if(k != N - 1){
					System.out.printf("%d ", arr[k]);
				} else{
					System.out.printf("%d\n", arr[k]);
				}
			}
		}
	} int N = scan.nextInt(); N scan.nextInt() scan.nextInt scan int[] arr = new int[N]; arr new int[N] N for(int i = 0; i < N; i++){
			int num = scan.nextInt();
			arr[i] = num;
		} int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
			int num = scan.nextInt();
			arr[i] = num;
		} {
			int num = scan.nextInt();
			arr[i] = num;
		} int num = scan.nextInt(); num scan.nextInt() scan.nextInt scan arr[i] = num arr[i] arr i num for(int i = 0; i < N; i++){
			if(i != N - 1){
				System.out.printf("%d ", arr[i]);
			} else{
				System.out.printf("%d\n", arr[i]);
			}
		} int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
			if(i != N - 1){
				System.out.printf("%d ", arr[i]);
			} else{
				System.out.printf("%d\n", arr[i]);
			}
		} {
			if(i != N - 1){
				System.out.printf("%d ", arr[i]);
			} else{
				System.out.printf("%d\n", arr[i]);
			}
		} if(i != N - 1){
				System.out.printf("%d ", arr[i]);
			} else{
				System.out.printf("%d\n", arr[i]);
			} i != N - 1 i N - 1 N 1 {
				System.out.printf("%d ", arr[i]);
			} System.out.printf("%d ", arr[i]) System.out.printf System.out System System.out "%d " arr[i] arr i {
				System.out.printf("%d\n", arr[i]);
			} System.out.printf("%d\n", arr[i]) System.out.printf System.out System System.out "%d\n" arr[i] arr i for(int i = 1; i < N; i++){
			int v = arr[i];
			int j = i - 1;
			while(j >= 0 && arr[j] > v){
				arr[j + 1] = arr[j];
				j--;
				arr[j + 1] = v;
			}
			for(int k = 0; k < N; k++){
				if(k != N - 1){
					System.out.printf("%d ", arr[k]);
				} else{
					System.out.printf("%d\n", arr[k]);
				}
			}
		} int i = 1; int i = 1; i 1 i < N i N i++ i++ i {
			int v = arr[i];
			int j = i - 1;
			while(j >= 0 && arr[j] > v){
				arr[j + 1] = arr[j];
				j--;
				arr[j + 1] = v;
			}
			for(int k = 0; k < N; k++){
				if(k != N - 1){
					System.out.printf("%d ", arr[k]);
				} else{
					System.out.printf("%d\n", arr[k]);
				}
			}
		} {
			int v = arr[i];
			int j = i - 1;
			while(j >= 0 && arr[j] > v){
				arr[j + 1] = arr[j];
				j--;
				arr[j + 1] = v;
			}
			for(int k = 0; k < N; k++){
				if(k != N - 1){
					System.out.printf("%d ", arr[k]);
				} else{
					System.out.printf("%d\n", arr[k]);
				}
			}
		} int v = arr[i]; v arr[i] arr i int j = i - 1; j i - 1 i 1 while(j >= 0 && arr[j] > v){
				arr[j + 1] = arr[j];
				j--;
				arr[j + 1] = v;
			} j >= 0 && arr[j] > v j >= 0 j 0 arr[j] > v arr[j] arr j v {
				arr[j + 1] = arr[j];
				j--;
				arr[j + 1] = v;
			} arr[j + 1] = arr[j] arr[j + 1] arr j + 1 j 1 arr[j] arr j j-- j arr[j + 1] = v arr[j + 1] arr j + 1 j 1 v for(int k = 0; k < N; k++){
				if(k != N - 1){
					System.out.printf("%d ", arr[k]);
				} else{
					System.out.printf("%d\n", arr[k]);
				}
			} int k = 0; int k = 0; k 0 k < N k N k++ k++ k {
				if(k != N - 1){
					System.out.printf("%d ", arr[k]);
				} else{
					System.out.printf("%d\n", arr[k]);
				}
			} {
				if(k != N - 1){
					System.out.printf("%d ", arr[k]);
				} else{
					System.out.printf("%d\n", arr[k]);
				}
			} if(k != N - 1){
					System.out.printf("%d ", arr[k]);
				} else{
					System.out.printf("%d\n", arr[k]);
				} k != N - 1 k N - 1 N 1 {
					System.out.printf("%d ", arr[k]);
				} System.out.printf("%d ", arr[k]) System.out.printf System.out System System.out "%d " arr[k] arr k {
					System.out.printf("%d\n", arr[k]);
				} System.out.printf("%d\n", arr[k]) System.out.printf System.out System System.out "%d\n" arr[k] arr k String[] args args public class Main{
	private static final Scanner scan = new Scanner(System.in);

	public static void main(String[] args){

		int N = scan.nextInt();
		int[] arr = new int[N];
		for(int i = 0; i < N; i++){
			int num = scan.nextInt();
			arr[i] = num;
		}
		
		for(int i = 0; i < N; i++){
			if(i != N - 1){
				System.out.printf("%d ", arr[i]);
			} else{
				System.out.printf("%d\n", arr[i]);
			}
		}

		for(int i = 1; i < N; i++){
			int v = arr[i];
			int j = i - 1;
			while(j >= 0 && arr[j] > v){
				arr[j + 1] = arr[j];
				j--;
				arr[j + 1] = v;
			}
			for(int k = 0; k < N; k++){
				if(k != N - 1){
					System.out.printf("%d ", arr[k]);
				} else{
					System.out.printf("%d\n", arr[k]);
				}
			}
		}
	}
} public class Main{
	private static final Scanner scan = new Scanner(System.in);

	public static void main(String[] args){

		int N = scan.nextInt();
		int[] arr = new int[N];
		for(int i = 0; i < N; i++){
			int num = scan.nextInt();
			arr[i] = num;
		}
		
		for(int i = 0; i < N; i++){
			if(i != N - 1){
				System.out.printf("%d ", arr[i]);
			} else{
				System.out.printf("%d\n", arr[i]);
			}
		}

		for(int i = 1; i < N; i++){
			int v = arr[i];
			int j = i - 1;
			while(j >= 0 && arr[j] > v){
				arr[j + 1] = arr[j];
				j--;
				arr[j + 1] = v;
			}
			for(int k = 0; k < N; k++){
				if(k != N - 1){
					System.out.printf("%d ", arr[k]);
				} else{
					System.out.printf("%d\n", arr[k]);
				}
			}
		}
	}
} Main
import java.util.*;

public class Main{
	private static final Scanner scan = new Scanner(System.in);

	public static void main(String[] args){

		int N = scan.nextInt();
		int[] arr = new int[N];
		for(int i = 0; i < N; i++){
			int num = scan.nextInt();
			arr[i] = num;
		}
		
		for(int i = 0; i < N; i++){
			if(i != N - 1){
				System.out.printf("%d ", arr[i]);
			} else{
				System.out.printf("%d\n", arr[i]);
			}
		}

		for(int i = 1; i < N; i++){
			int v = arr[i];
			int j = i - 1;
			while(j >= 0 && arr[j] > v){
				arr[j + 1] = arr[j];
				j--;
				arr[j + 1] = v;
			}
			for(int k = 0; k < N; k++){
				if(k != N - 1){
					System.out.printf("%d ", arr[k]);
				} else{
					System.out.printf("%d\n", arr[k]);
				}
			}
		}
	}
}