import java.io.*;

public class Main {

	public static void main(String[] args) {
		try{
			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			int length = Integer.parseInt(br.readLine());
			String[] str = br.readLine().split(" ");
			
			int[] array = new int[length];
			for (int i = 0 ; i< length ; i++){
				array[i] = Integer.parseInt(str[i]);
			}
			
			InsertionSort.Sort(array);
			
		}catch(Exception e){
			System.out.println("??¨??????");
		}
	}
}

class InsertionSort{

	static void Sort(int[] array){
		for (int i = 0 ; i< array.length ; i++){
			OneSort(array,i);
			Display(array);
		}
	}
	
	static void OneSort(int[] array, int index){
		int v = array[index];
		while (index != 0 && array[index-1] > v){
			array[index] = array[index-1];
			index--;
		}
		array[index] = v;
	}
	
	static void Display(int[] array){
		
		StringBuilder sb = new StringBuilder();
		for (int i = 0; i < array.length-1; i++){
			sb.append(Integer.toString(array[i]));
			sb.append(" ");
		}
		sb.append(Integer.toString(array[array.length-1]));
		System.out.println(sb.toString());
	}
} import java.io.*; io.* java public class Main {

	public static void main(String[] args) {
		try{
			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			int length = Integer.parseInt(br.readLine());
			String[] str = br.readLine().split(" ");
			
			int[] array = new int[length];
			for (int i = 0 ; i< length ; i++){
				array[i] = Integer.parseInt(str[i]);
			}
			
			InsertionSort.Sort(array);
			
		}catch(Exception e){
			System.out.println("??¨??????");
		}
	}
} Main public static void main(String[] args) {
		try{
			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			int length = Integer.parseInt(br.readLine());
			String[] str = br.readLine().split(" ");
			
			int[] array = new int[length];
			for (int i = 0 ; i< length ; i++){
				array[i] = Integer.parseInt(str[i]);
			}
			
			InsertionSort.Sort(array);
			
		}catch(Exception e){
			System.out.println("??¨??????");
		}
	} main {
		try{
			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			int length = Integer.parseInt(br.readLine());
			String[] str = br.readLine().split(" ");
			
			int[] array = new int[length];
			for (int i = 0 ; i< length ; i++){
				array[i] = Integer.parseInt(str[i]);
			}
			
			InsertionSort.Sort(array);
			
		}catch(Exception e){
			System.out.println("??¨??????");
		}
	} try{
			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			int length = Integer.parseInt(br.readLine());
			String[] str = br.readLine().split(" ");
			
			int[] array = new int[length];
			for (int i = 0 ; i< length ; i++){
				array[i] = Integer.parseInt(str[i]);
			}
			
			InsertionSort.Sort(array);
			
		}catch(Exception e){
			System.out.println("??¨??????");
		} catch(Exception e){
			System.out.println("??¨??????");
		} Exception e {
			System.out.println("??¨??????");
		} System.out.println("??¨??????") System.out.println System.out System System.out "??¨??????" {
			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			int length = Integer.parseInt(br.readLine());
			String[] str = br.readLine().split(" ");
			
			int[] array = new int[length];
			for (int i = 0 ; i< length ; i++){
				array[i] = Integer.parseInt(str[i]);
			}
			
			InsertionSort.Sort(array);
			
		} BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) int length = Integer.parseInt(br.readLine()); length Integer.parseInt(br.readLine()) Integer.parseInt Integer br.readLine() br.readLine br String[] str = br.readLine().split(" "); str br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " int[] array = new int[length]; array new int[length] length for (int i = 0 ; i< length ; i++){
				array[i] = Integer.parseInt(str[i]);
			} int i = 0 ; int i = 0 ; i 0 i< length i length i++ i++ i {
				array[i] = Integer.parseInt(str[i]);
			} {
				array[i] = Integer.parseInt(str[i]);
			} array[i] = Integer.parseInt(str[i]) array[i] array i Integer.parseInt(str[i]) Integer.parseInt Integer str[i] str i InsertionSort.Sort(array) InsertionSort.Sort InsertionSort array String[] args args class InsertionSort{

	static void Sort(int[] array){
		for (int i = 0 ; i< array.length ; i++){
			OneSort(array,i);
			Display(array);
		}
	}
	
	static void OneSort(int[] array, int index){
		int v = array[index];
		while (index != 0 && array[index-1] > v){
			array[index] = array[index-1];
			index--;
		}
		array[index] = v;
	}
	
	static void Display(int[] array){
		
		StringBuilder sb = new StringBuilder();
		for (int i = 0; i < array.length-1; i++){
			sb.append(Integer.toString(array[i]));
			sb.append(" ");
		}
		sb.append(Integer.toString(array[array.length-1]));
		System.out.println(sb.toString());
	}
} InsertionSort static void Sort(int[] array){
		for (int i = 0 ; i< array.length ; i++){
			OneSort(array,i);
			Display(array);
		}
	} Sort {
		for (int i = 0 ; i< array.length ; i++){
			OneSort(array,i);
			Display(array);
		}
	} for (int i = 0 ; i< array.length ; i++){
			OneSort(array,i);
			Display(array);
		} int i = 0 ; int i = 0 ; i 0 i< array.length i array.length array array.length i++ i++ i {
			OneSort(array,i);
			Display(array);
		} {
			OneSort(array,i);
			Display(array);
		} OneSort(array,i) OneSort array i Display(array) Display array int[] array array static void OneSort(int[] array, int index){
		int v = array[index];
		while (index != 0 && array[index-1] > v){
			array[index] = array[index-1];
			index--;
		}
		array[index] = v;
	} OneSort {
		int v = array[index];
		while (index != 0 && array[index-1] > v){
			array[index] = array[index-1];
			index--;
		}
		array[index] = v;
	} int v = array[index]; v array[index] array index while (index != 0 && array[index-1] > v){
			array[index] = array[index-1];
			index--;
		} index != 0 && array[index-1] > v index != 0 index 0 array[index-1] > v array[index-1] array index-1 index 1 v {
			array[index] = array[index-1];
			index--;
		} array[index] = array[index-1] array[index] array index array[index-1] array index-1 index 1 index-- index array[index] = v array[index] array index v int[] array array int index index static void Display(int[] array){
		
		StringBuilder sb = new StringBuilder();
		for (int i = 0; i < array.length-1; i++){
			sb.append(Integer.toString(array[i]));
			sb.append(" ");
		}
		sb.append(Integer.toString(array[array.length-1]));
		System.out.println(sb.toString());
	} Display {
		
		StringBuilder sb = new StringBuilder();
		for (int i = 0; i < array.length-1; i++){
			sb.append(Integer.toString(array[i]));
			sb.append(" ");
		}
		sb.append(Integer.toString(array[array.length-1]));
		System.out.println(sb.toString());
	} StringBuilder sb = new StringBuilder(); sb new StringBuilder() for (int i = 0; i < array.length-1; i++){
			sb.append(Integer.toString(array[i]));
			sb.append(" ");
		} int i = 0; int i = 0; i 0 i < array.length-1 i array.length-1 array.length array array.length 1 i++ i++ i {
			sb.append(Integer.toString(array[i]));
			sb.append(" ");
		} {
			sb.append(Integer.toString(array[i]));
			sb.append(" ");
		} sb.append(Integer.toString(array[i])) sb.append sb Integer.toString(array[i]) Integer.toString Integer array[i] array i sb.append(" ") sb.append sb " " sb.append(Integer.toString(array[array.length-1])) sb.append sb Integer.toString(array[array.length-1]) Integer.toString Integer array[array.length-1] array array.length-1 array.length array array.length 1 System.out.println(sb.toString()) System.out.println System.out System System.out sb.toString() sb.toString sb int[] array array public class Main {

	public static void main(String[] args) {
		try{
			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			int length = Integer.parseInt(br.readLine());
			String[] str = br.readLine().split(" ");
			
			int[] array = new int[length];
			for (int i = 0 ; i< length ; i++){
				array[i] = Integer.parseInt(str[i]);
			}
			
			InsertionSort.Sort(array);
			
		}catch(Exception e){
			System.out.println("??¨??????");
		}
	}
} public class Main {

	public static void main(String[] args) {
		try{
			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			int length = Integer.parseInt(br.readLine());
			String[] str = br.readLine().split(" ");
			
			int[] array = new int[length];
			for (int i = 0 ; i< length ; i++){
				array[i] = Integer.parseInt(str[i]);
			}
			
			InsertionSort.Sort(array);
			
		}catch(Exception e){
			System.out.println("??¨??????");
		}
	}
} Main
import java.io.*;

public class Main {

	public static void main(String[] args) {
		try{
			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			int length = Integer.parseInt(br.readLine());
			String[] str = br.readLine().split(" ");
			
			int[] array = new int[length];
			for (int i = 0 ; i< length ; i++){
				array[i] = Integer.parseInt(str[i]);
			}
			
			InsertionSort.Sort(array);
			
		}catch(Exception e){
			System.out.println("??¨??????");
		}
	}
}

class InsertionSort{

	static void Sort(int[] array){
		for (int i = 0 ; i< array.length ; i++){
			OneSort(array,i);
			Display(array);
		}
	}
	
	static void OneSort(int[] array, int index){
		int v = array[index];
		while (index != 0 && array[index-1] > v){
			array[index] = array[index-1];
			index--;
		}
		array[index] = v;
	}
	
	static void Display(int[] array){
		
		StringBuilder sb = new StringBuilder();
		for (int i = 0; i < array.length-1; i++){
			sb.append(Integer.toString(array[i]));
			sb.append(" ");
		}
		sb.append(Integer.toString(array[array.length-1]));
		System.out.println(sb.toString());
	}
}