import java.util.*;

class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.nextLine());
		String[] line=sc.nextLine().split(" ");
		int[] a = new int[n];
		for(int i=0;i<n;i++){
			a[i]=Integer.parseInt(line[i]);
		}
		for(int i=0;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;
			for(int k=0;k<n-1;k++){
				System.out.print(a[k]+" ");
			}
			System.out.println(a[n-1]);
		}
	}
} import java.util.*; util.* java class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.nextLine());
		String[] line=sc.nextLine().split(" ");
		int[] a = new int[n];
		for(int i=0;i<n;i++){
			a[i]=Integer.parseInt(line[i]);
		}
		for(int i=0;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;
			for(int k=0;k<n-1;k++){
				System.out.print(a[k]+" ");
			}
			System.out.println(a[n-1]);
		}
	}
} Main public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.nextLine());
		String[] line=sc.nextLine().split(" ");
		int[] a = new int[n];
		for(int i=0;i<n;i++){
			a[i]=Integer.parseInt(line[i]);
		}
		for(int i=0;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;
			for(int k=0;k<n-1;k++){
				System.out.print(a[k]+" ");
			}
			System.out.println(a[n-1]);
		}
	} main {
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.nextLine());
		String[] line=sc.nextLine().split(" ");
		int[] a = new int[n];
		for(int i=0;i<n;i++){
			a[i]=Integer.parseInt(line[i]);
		}
		for(int i=0;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;
			for(int k=0;k<n-1;k++){
				System.out.print(a[k]+" ");
			}
			System.out.println(a[n-1]);
		}
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = Integer.parseInt(sc.nextLine()); n Integer.parseInt(sc.nextLine()) Integer.parseInt Integer sc.nextLine() sc.nextLine sc String[] line=sc.nextLine().split(" "); line sc.nextLine().split(" ") sc.nextLine().split sc.nextLine() sc.nextLine sc " " int[] a = new int[n]; a new int[n] n for(int i=0;i<n;i++){
			a[i]=Integer.parseInt(line[i]);
		} int i=0; int i=0; i 0 i<n i n i++ i++ i {
			a[i]=Integer.parseInt(line[i]);
		} {
			a[i]=Integer.parseInt(line[i]);
		} a[i]=Integer.parseInt(line[i]) a[i] a i Integer.parseInt(line[i]) Integer.parseInt Integer line[i] line i for(int i=0;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;
			for(int k=0;k<n-1;k++){
				System.out.print(a[k]+" ");
			}
			System.out.println(a[n-1]);
		} int i=0; int i=0; i 0 i<n i n i++ i++ 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;
			for(int k=0;k<n-1;k++){
				System.out.print(a[k]+" ");
			}
			System.out.println(a[n-1]);
		} {
			int v=a[i];
			int j=i-1;
			while(j>=0 && a[j]>v){
				a[j+1]=a[j];
				j--;
			}
			a[j+1]=v;
			for(int k=0;k<n-1;k++){
				System.out.print(a[k]+" ");
			}
			System.out.println(a[n-1]);
		} int v=a[i]; v a[i] a i int j=i-1; j i-1 i 1 while(j>=0 && a[j]>v){
				a[j+1]=a[j];
				j--;
			} j>=0 && a[j]>v j>=0 j 0 a[j]>v a[j] a j v {
				a[j+1]=a[j];
				j--;
			} a[j+1]=a[j] a[j+1] a j+1 j 1 a[j] a j j-- j a[j+1]=v a[j+1] a j+1 j 1 v for(int k=0;k<n-1;k++){
				System.out.print(a[k]+" ");
			} int k=0; int k=0; k 0 k<n-1 k n-1 n 1 k++ k++ k {
				System.out.print(a[k]+" ");
			} {
				System.out.print(a[k]+" ");
			} System.out.print(a[k]+" ") System.out.print System.out System System.out a[k]+" " a[k] a k " " System.out.println(a[n-1]) System.out.println System.out System System.out a[n-1] a n-1 n 1 String[] args args
import java.util.*;

class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = Integer.parseInt(sc.nextLine());
		String[] line=sc.nextLine().split(" ");
		int[] a = new int[n];
		for(int i=0;i<n;i++){
			a[i]=Integer.parseInt(line[i]);
		}
		for(int i=0;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;
			for(int k=0;k<n-1;k++){
				System.out.print(a[k]+" ");
			}
			System.out.println(a[n-1]);
		}
	}
}
