import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int x = sc.nextInt();
		int[] array = new int[x];

		for(int i=0;i<x;i++) {
			array[i] = sc.nextInt();
		}

		show(array, x);
		insertionSort(array, x);

		sc.close();
	}

	public static void show(int[] array, int x) {
		for(int i=0;i<x;i++) {
			System.out.print(array[i]);
			if(i!=x-1) {
				System.out.print(" ");
			}
		}
		System.out.println();
	}

	public static void insertionSort(int[] array, int x) {
		int j,i,v;
		for(i=1;i<x;i++) {
			v=array[i];
			j=i-1;
			while(j>=0 && array[j]>v) {
				array[j+1] = array[j];
				j--;
			}
			array[j+1]=v;
			show(array,x);
		}
	}
} import java.util.Scanner; Scanner java.util public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int x = sc.nextInt();
		int[] array = new int[x];

		for(int i=0;i<x;i++) {
			array[i] = sc.nextInt();
		}

		show(array, x);
		insertionSort(array, x);

		sc.close();
	}

	public static void show(int[] array, int x) {
		for(int i=0;i<x;i++) {
			System.out.print(array[i]);
			if(i!=x-1) {
				System.out.print(" ");
			}
		}
		System.out.println();
	}

	public static void insertionSort(int[] array, int x) {
		int j,i,v;
		for(i=1;i<x;i++) {
			v=array[i];
			j=i-1;
			while(j>=0 && array[j]>v) {
				array[j+1] = array[j];
				j--;
			}
			array[j+1]=v;
			show(array,x);
		}
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int x = sc.nextInt();
		int[] array = new int[x];

		for(int i=0;i<x;i++) {
			array[i] = sc.nextInt();
		}

		show(array, x);
		insertionSort(array, x);

		sc.close();
	} main {
		Scanner sc = new Scanner(System.in);

		int x = sc.nextInt();
		int[] array = new int[x];

		for(int i=0;i<x;i++) {
			array[i] = sc.nextInt();
		}

		show(array, x);
		insertionSort(array, x);

		sc.close();
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int x = sc.nextInt(); x sc.nextInt() sc.nextInt sc int[] array = new int[x]; array new int[x] x for(int i=0;i<x;i++) {
			array[i] = sc.nextInt();
		} int i=0; int i=0; i 0 i<x i x i++ i++ i {
			array[i] = sc.nextInt();
		} {
			array[i] = sc.nextInt();
		} array[i] = sc.nextInt() array[i] array i sc.nextInt() sc.nextInt sc show(array, x) show array x insertionSort(array, x) insertionSort array x sc.close() sc.close sc String[] args args public static void show(int[] array, int x) {
		for(int i=0;i<x;i++) {
			System.out.print(array[i]);
			if(i!=x-1) {
				System.out.print(" ");
			}
		}
		System.out.println();
	} show {
		for(int i=0;i<x;i++) {
			System.out.print(array[i]);
			if(i!=x-1) {
				System.out.print(" ");
			}
		}
		System.out.println();
	} for(int i=0;i<x;i++) {
			System.out.print(array[i]);
			if(i!=x-1) {
				System.out.print(" ");
			}
		} int i=0; int i=0; i 0 i<x i x i++ i++ i {
			System.out.print(array[i]);
			if(i!=x-1) {
				System.out.print(" ");
			}
		} {
			System.out.print(array[i]);
			if(i!=x-1) {
				System.out.print(" ");
			}
		} System.out.print(array[i]) System.out.print System.out System System.out array[i] array i if(i!=x-1) {
				System.out.print(" ");
			} i!=x-1 i x-1 x 1 {
				System.out.print(" ");
			} System.out.print(" ") System.out.print System.out System System.out " " System.out.println() System.out.println System.out System System.out int[] array array int x x public static void insertionSort(int[] array, int x) {
		int j,i,v;
		for(i=1;i<x;i++) {
			v=array[i];
			j=i-1;
			while(j>=0 && array[j]>v) {
				array[j+1] = array[j];
				j--;
			}
			array[j+1]=v;
			show(array,x);
		}
	} insertionSort {
		int j,i,v;
		for(i=1;i<x;i++) {
			v=array[i];
			j=i-1;
			while(j>=0 && array[j]>v) {
				array[j+1] = array[j];
				j--;
			}
			array[j+1]=v;
			show(array,x);
		}
	} int j j i i v; v for(i=1;i<x;i++) {
			v=array[i];
			j=i-1;
			while(j>=0 && array[j]>v) {
				array[j+1] = array[j];
				j--;
			}
			array[j+1]=v;
			show(array,x);
		} i=1; i=1 i 1 i<x i x i++ i++ i {
			v=array[i];
			j=i-1;
			while(j>=0 && array[j]>v) {
				array[j+1] = array[j];
				j--;
			}
			array[j+1]=v;
			show(array,x);
		} {
			v=array[i];
			j=i-1;
			while(j>=0 && array[j]>v) {
				array[j+1] = array[j];
				j--;
			}
			array[j+1]=v;
			show(array,x);
		} v=array[i] v array[i] array i j=i-1 j i-1 i 1 while(j>=0 && array[j]>v) {
				array[j+1] = array[j];
				j--;
			} j>=0 && array[j]>v j>=0 j 0 array[j]>v array[j] array j v {
				array[j+1] = array[j];
				j--;
			} array[j+1] = array[j] array[j+1] array j+1 j 1 array[j] array j j-- j array[j+1]=v array[j+1] array j+1 j 1 v show(array,x) show array x int[] array array int x x public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int x = sc.nextInt();
		int[] array = new int[x];

		for(int i=0;i<x;i++) {
			array[i] = sc.nextInt();
		}

		show(array, x);
		insertionSort(array, x);

		sc.close();
	}

	public static void show(int[] array, int x) {
		for(int i=0;i<x;i++) {
			System.out.print(array[i]);
			if(i!=x-1) {
				System.out.print(" ");
			}
		}
		System.out.println();
	}

	public static void insertionSort(int[] array, int x) {
		int j,i,v;
		for(i=1;i<x;i++) {
			v=array[i];
			j=i-1;
			while(j>=0 && array[j]>v) {
				array[j+1] = array[j];
				j--;
			}
			array[j+1]=v;
			show(array,x);
		}
	}
} public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int x = sc.nextInt();
		int[] array = new int[x];

		for(int i=0;i<x;i++) {
			array[i] = sc.nextInt();
		}

		show(array, x);
		insertionSort(array, x);

		sc.close();
	}

	public static void show(int[] array, int x) {
		for(int i=0;i<x;i++) {
			System.out.print(array[i]);
			if(i!=x-1) {
				System.out.print(" ");
			}
		}
		System.out.println();
	}

	public static void insertionSort(int[] array, int x) {
		int j,i,v;
		for(i=1;i<x;i++) {
			v=array[i];
			j=i-1;
			while(j>=0 && array[j]>v) {
				array[j+1] = array[j];
				j--;
			}
			array[j+1]=v;
			show(array,x);
		}
	}
} Main
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int x = sc.nextInt();
		int[] array = new int[x];

		for(int i=0;i<x;i++) {
			array[i] = sc.nextInt();
		}

		show(array, x);
		insertionSort(array, x);

		sc.close();
	}

	public static void show(int[] array, int x) {
		for(int i=0;i<x;i++) {
			System.out.print(array[i]);
			if(i!=x-1) {
				System.out.print(" ");
			}
		}
		System.out.println();
	}

	public static void insertionSort(int[] array, int x) {
		int j,i,v;
		for(i=1;i<x;i++) {
			v=array[i];
			j=i-1;
			while(j>=0 && array[j]>v) {
				array[j+1] = array[j];
				j--;
			}
			array[j+1]=v;
			show(array,x);
		}
	}
}
