
import java.util.Scanner;

class Main {
	public static void main(String args[]){
		Scanner scan = new Scanner(System.in);
		
		int N = scan.nextInt();
		
		int v, j;
		int[] A = new int[N];
		
		for(int i = 0; i < N; i++){
			A[i] = scan.nextInt();
		}
		
		for(int k = 0; k < N; k++){
			System.out.print(A[k]);
			if(k < N-1)System.out.print(" ");
		}
		System.out.println();
		
		for(int i = 1; i < N; i++){
			v = A[i];
			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; k++){
				System.out.print(A[k]);
				if(k < N-1)System.out.print(" ");
			}
			System.out.println();
		}
	}
} import java.util.Scanner; Scanner java.util class Main {
	public static void main(String args[]){
		Scanner scan = new Scanner(System.in);
		
		int N = scan.nextInt();
		
		int v, j;
		int[] A = new int[N];
		
		for(int i = 0; i < N; i++){
			A[i] = scan.nextInt();
		}
		
		for(int k = 0; k < N; k++){
			System.out.print(A[k]);
			if(k < N-1)System.out.print(" ");
		}
		System.out.println();
		
		for(int i = 1; i < N; i++){
			v = A[i];
			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; k++){
				System.out.print(A[k]);
				if(k < N-1)System.out.print(" ");
			}
			System.out.println();
		}
	}
} Main public static void main(String args[]){
		Scanner scan = new Scanner(System.in);
		
		int N = scan.nextInt();
		
		int v, j;
		int[] A = new int[N];
		
		for(int i = 0; i < N; i++){
			A[i] = scan.nextInt();
		}
		
		for(int k = 0; k < N; k++){
			System.out.print(A[k]);
			if(k < N-1)System.out.print(" ");
		}
		System.out.println();
		
		for(int i = 1; i < N; i++){
			v = A[i];
			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; k++){
				System.out.print(A[k]);
				if(k < N-1)System.out.print(" ");
			}
			System.out.println();
		}
	} main {
		Scanner scan = new Scanner(System.in);
		
		int N = scan.nextInt();
		
		int v, j;
		int[] A = new int[N];
		
		for(int i = 0; i < N; i++){
			A[i] = scan.nextInt();
		}
		
		for(int k = 0; k < N; k++){
			System.out.print(A[k]);
			if(k < N-1)System.out.print(" ");
		}
		System.out.println();
		
		for(int i = 1; i < N; i++){
			v = A[i];
			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; k++){
				System.out.print(A[k]);
				if(k < N-1)System.out.print(" ");
			}
			System.out.println();
		}
	} Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int N = scan.nextInt(); N scan.nextInt() scan.nextInt scan int v v j; j int[] A = new int[N]; A new int[N] N for(int i = 0; i < N; i++){
			A[i] = scan.nextInt();
		} int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
			A[i] = scan.nextInt();
		} {
			A[i] = scan.nextInt();
		} A[i] = scan.nextInt() A[i] A i scan.nextInt() scan.nextInt scan for(int k = 0; k < N; k++){
			System.out.print(A[k]);
			if(k < N-1)System.out.print(" ");
		} int k = 0; int k = 0; k 0 k < N k N k++ k++ k {
			System.out.print(A[k]);
			if(k < N-1)System.out.print(" ");
		} {
			System.out.print(A[k]);
			if(k < N-1)System.out.print(" ");
		} System.out.print(A[k]) System.out.print System.out System System.out A[k] A k if(k < N-1)System.out.print(" "); k < N-1 k N-1 N 1 System.out.print(" ") System.out.print System.out System System.out " " System.out.println() System.out.println System.out System System.out for(int i = 1; i < N; i++){
			v = A[i];
			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; k++){
				System.out.print(A[k]);
				if(k < N-1)System.out.print(" ");
			}
			System.out.println();
		} int i = 1; int i = 1; i 1 i < N i N i++ i++ i {
			v = A[i];
			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; k++){
				System.out.print(A[k]);
				if(k < N-1)System.out.print(" ");
			}
			System.out.println();
		} {
			v = A[i];
			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; k++){
				System.out.print(A[k]);
				if(k < N-1)System.out.print(" ");
			}
			System.out.println();
		} v = A[i] v A[i] A i 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; k++){
				System.out.print(A[k]);
				if(k < N-1)System.out.print(" ");
			} int k = 0; int k = 0; k 0 k < N k N k++ k++ k {
				System.out.print(A[k]);
				if(k < N-1)System.out.print(" ");
			} {
				System.out.print(A[k]);
				if(k < N-1)System.out.print(" ");
			} System.out.print(A[k]) System.out.print System.out System System.out A[k] A k if(k < N-1)System.out.print(" "); k < N-1 k N-1 N 1 System.out.print(" ") System.out.print System.out System System.out " " System.out.println() System.out.println System.out System System.out String args[] args

import java.util.Scanner;

class Main {
	public static void main(String args[]){
		Scanner scan = new Scanner(System.in);
		
		int N = scan.nextInt();
		
		int v, j;
		int[] A = new int[N];
		
		for(int i = 0; i < N; i++){
			A[i] = scan.nextInt();
		}
		
		for(int k = 0; k < N; k++){
			System.out.print(A[k]);
			if(k < N-1)System.out.print(" ");
		}
		System.out.println();
		
		for(int i = 1; i < N; i++){
			v = A[i];
			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; k++){
				System.out.print(A[k]);
				if(k < N-1)System.out.print(" ");
			}
			System.out.println();
		}
	}
}