import java.util.Scanner;

class Main{
	public static void main (String[] args){
		
		Scanner sc = new Scanner(System.in);
		
		int N = sc.nextInt();//??????????????????
		
		int [] intAry = new int[N];
		
		for( int i = 0 ; i < intAry.length ; i++){
			intAry[i] = sc.nextInt();
		}
		
		for( int i = 0 ; i < intAry.length ; i++){
			
			if( i == 0){
				System.out.print(intAry[i]);
			}else{
				System.out.print(" " + intAry[i]);
			}
		}
		
		System.out.println();
		
		for (int i = 1; i < intAry.length; i++) {
			int j = i;
			while(j > 0 && intAry[j-1] > intAry[j]){
				int temp = intAry[j];
				intAry[j] = intAry[j-1];
				intAry[j-1] = temp;
				j--;
			}
			for( int x = 0 ; x < N ; x++ ){
				if( x == 0){
					System.out.print(intAry[x]);
				}else{
					System.out.print(" " + intAry[x]);
				}
			}
			System.out.println();
		}
	}
} import java.util.Scanner; Scanner java.util class Main{
	public static void main (String[] args){
		
		Scanner sc = new Scanner(System.in);
		
		int N = sc.nextInt();//??????????????????
		
		int [] intAry = new int[N];
		
		for( int i = 0 ; i < intAry.length ; i++){
			intAry[i] = sc.nextInt();
		}
		
		for( int i = 0 ; i < intAry.length ; i++){
			
			if( i == 0){
				System.out.print(intAry[i]);
			}else{
				System.out.print(" " + intAry[i]);
			}
		}
		
		System.out.println();
		
		for (int i = 1; i < intAry.length; i++) {
			int j = i;
			while(j > 0 && intAry[j-1] > intAry[j]){
				int temp = intAry[j];
				intAry[j] = intAry[j-1];
				intAry[j-1] = temp;
				j--;
			}
			for( int x = 0 ; x < N ; x++ ){
				if( x == 0){
					System.out.print(intAry[x]);
				}else{
					System.out.print(" " + intAry[x]);
				}
			}
			System.out.println();
		}
	}
} Main public static void main (String[] args){
		
		Scanner sc = new Scanner(System.in);
		
		int N = sc.nextInt();//??????????????????
		
		int [] intAry = new int[N];
		
		for( int i = 0 ; i < intAry.length ; i++){
			intAry[i] = sc.nextInt();
		}
		
		for( int i = 0 ; i < intAry.length ; i++){
			
			if( i == 0){
				System.out.print(intAry[i]);
			}else{
				System.out.print(" " + intAry[i]);
			}
		}
		
		System.out.println();
		
		for (int i = 1; i < intAry.length; i++) {
			int j = i;
			while(j > 0 && intAry[j-1] > intAry[j]){
				int temp = intAry[j];
				intAry[j] = intAry[j-1];
				intAry[j-1] = temp;
				j--;
			}
			for( int x = 0 ; x < N ; x++ ){
				if( x == 0){
					System.out.print(intAry[x]);
				}else{
					System.out.print(" " + intAry[x]);
				}
			}
			System.out.println();
		}
	} main {
		
		Scanner sc = new Scanner(System.in);
		
		int N = sc.nextInt();//??????????????????
		
		int [] intAry = new int[N];
		
		for( int i = 0 ; i < intAry.length ; i++){
			intAry[i] = sc.nextInt();
		}
		
		for( int i = 0 ; i < intAry.length ; i++){
			
			if( i == 0){
				System.out.print(intAry[i]);
			}else{
				System.out.print(" " + intAry[i]);
			}
		}
		
		System.out.println();
		
		for (int i = 1; i < intAry.length; i++) {
			int j = i;
			while(j > 0 && intAry[j-1] > intAry[j]){
				int temp = intAry[j];
				intAry[j] = intAry[j-1];
				intAry[j-1] = temp;
				j--;
			}
			for( int x = 0 ; x < N ; x++ ){
				if( x == 0){
					System.out.print(intAry[x]);
				}else{
					System.out.print(" " + intAry[x]);
				}
			}
			System.out.println();
		}
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc int [] intAry = new int[N]; intAry new int[N] N for( int i = 0 ; i < intAry.length ; i++){
			intAry[i] = sc.nextInt();
		} int i = 0 ; int i = 0 ; i 0 i < intAry.length i intAry.length intAry intAry.length i++ i++ i {
			intAry[i] = sc.nextInt();
		} {
			intAry[i] = sc.nextInt();
		} intAry[i] = sc.nextInt() intAry[i] intAry i sc.nextInt() sc.nextInt sc for( int i = 0 ; i < intAry.length ; i++){
			
			if( i == 0){
				System.out.print(intAry[i]);
			}else{
				System.out.print(" " + intAry[i]);
			}
		} int i = 0 ; int i = 0 ; i 0 i < intAry.length i intAry.length intAry intAry.length i++ i++ i {
			
			if( i == 0){
				System.out.print(intAry[i]);
			}else{
				System.out.print(" " + intAry[i]);
			}
		} {
			
			if( i == 0){
				System.out.print(intAry[i]);
			}else{
				System.out.print(" " + intAry[i]);
			}
		} if( i == 0){
				System.out.print(intAry[i]);
			}else{
				System.out.print(" " + intAry[i]);
			} i == 0 i 0 {
				System.out.print(intAry[i]);
			} System.out.print(intAry[i]) System.out.print System.out System System.out intAry[i] intAry i {
				System.out.print(" " + intAry[i]);
			} System.out.print(" " + intAry[i]) System.out.print System.out System System.out " " + intAry[i] " " intAry[i] intAry i System.out.println() System.out.println System.out System System.out for (int i = 1; i < intAry.length; i++) {
			int j = i;
			while(j > 0 && intAry[j-1] > intAry[j]){
				int temp = intAry[j];
				intAry[j] = intAry[j-1];
				intAry[j-1] = temp;
				j--;
			}
			for( int x = 0 ; x < N ; x++ ){
				if( x == 0){
					System.out.print(intAry[x]);
				}else{
					System.out.print(" " + intAry[x]);
				}
			}
			System.out.println();
		} int i = 1; int i = 1; i 1 i < intAry.length i intAry.length intAry intAry.length i++ i++ i {
			int j = i;
			while(j > 0 && intAry[j-1] > intAry[j]){
				int temp = intAry[j];
				intAry[j] = intAry[j-1];
				intAry[j-1] = temp;
				j--;
			}
			for( int x = 0 ; x < N ; x++ ){
				if( x == 0){
					System.out.print(intAry[x]);
				}else{
					System.out.print(" " + intAry[x]);
				}
			}
			System.out.println();
		} {
			int j = i;
			while(j > 0 && intAry[j-1] > intAry[j]){
				int temp = intAry[j];
				intAry[j] = intAry[j-1];
				intAry[j-1] = temp;
				j--;
			}
			for( int x = 0 ; x < N ; x++ ){
				if( x == 0){
					System.out.print(intAry[x]);
				}else{
					System.out.print(" " + intAry[x]);
				}
			}
			System.out.println();
		} int j = i; j i while(j > 0 && intAry[j-1] > intAry[j]){
				int temp = intAry[j];
				intAry[j] = intAry[j-1];
				intAry[j-1] = temp;
				j--;
			} j > 0 && intAry[j-1] > intAry[j] j > 0 j 0 intAry[j-1] > intAry[j] intAry[j-1] intAry j-1 j 1 intAry[j] intAry j {
				int temp = intAry[j];
				intAry[j] = intAry[j-1];
				intAry[j-1] = temp;
				j--;
			} int temp = intAry[j]; temp intAry[j] intAry j intAry[j] = intAry[j-1] intAry[j] intAry j intAry[j-1] intAry j-1 j 1 intAry[j-1] = temp intAry[j-1] intAry j-1 j 1 temp j-- j for( int x = 0 ; x < N ; x++ ){
				if( x == 0){
					System.out.print(intAry[x]);
				}else{
					System.out.print(" " + intAry[x]);
				}
			} int x = 0 ; int x = 0 ; x 0 x < N x N x++ x++ x {
				if( x == 0){
					System.out.print(intAry[x]);
				}else{
					System.out.print(" " + intAry[x]);
				}
			} {
				if( x == 0){
					System.out.print(intAry[x]);
				}else{
					System.out.print(" " + intAry[x]);
				}
			} if( x == 0){
					System.out.print(intAry[x]);
				}else{
					System.out.print(" " + intAry[x]);
				} x == 0 x 0 {
					System.out.print(intAry[x]);
				} System.out.print(intAry[x]) System.out.print System.out System System.out intAry[x] intAry x {
					System.out.print(" " + intAry[x]);
				} System.out.print(" " + intAry[x]) System.out.print System.out System System.out " " + intAry[x] " " intAry[x] intAry x 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 sc = new Scanner(System.in);
		
		int N = sc.nextInt();//??????????????????
		
		int [] intAry = new int[N];
		
		for( int i = 0 ; i < intAry.length ; i++){
			intAry[i] = sc.nextInt();
		}
		
		for( int i = 0 ; i < intAry.length ; i++){
			
			if( i == 0){
				System.out.print(intAry[i]);
			}else{
				System.out.print(" " + intAry[i]);
			}
		}
		
		System.out.println();
		
		for (int i = 1; i < intAry.length; i++) {
			int j = i;
			while(j > 0 && intAry[j-1] > intAry[j]){
				int temp = intAry[j];
				intAry[j] = intAry[j-1];
				intAry[j-1] = temp;
				j--;
			}
			for( int x = 0 ; x < N ; x++ ){
				if( x == 0){
					System.out.print(intAry[x]);
				}else{
					System.out.print(" " + intAry[x]);
				}
			}
			System.out.println();
		}
	}
}