import java.io.IOException;
import java.util.Scanner;

/**
 * 挿入ソート
 * 
 *
 */

public class Main {
	public static void main(String[] args) throws IOException {
		Scanner s = new Scanner(System.in);

		int n = s.nextInt();
		
		int[] arr = new int[n];
		for (int i = 0; i < n; i++) {
			arr[i] = s.nextInt();
		}
		
		printArray(arr);
		insertionSort(arr, n);
	}
	
	public static void insertionSort(int[] arr, int n) {
		for (int i = 1; i < n; i++) {
			int v = arr[i];
			int j = i-1;
			while (j >= 0 && arr[j] > v) {
				arr[j+1] = arr[j];
				j--;
			}
			arr[j+1] = v;
			printArray(arr);
		}
	}
	
	public static void printArray(int[] arr) {
		String ans = "";
		for (int i = 0; i < arr.length; i++) {
			ans += arr[i] + " ";
		}
		System.out.println(ans.trim());
	}
} import java.io.IOException; IOException java.io import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) throws IOException {
		Scanner s = new Scanner(System.in);

		int n = s.nextInt();
		
		int[] arr = new int[n];
		for (int i = 0; i < n; i++) {
			arr[i] = s.nextInt();
		}
		
		printArray(arr);
		insertionSort(arr, n);
	}
	
	public static void insertionSort(int[] arr, int n) {
		for (int i = 1; i < n; i++) {
			int v = arr[i];
			int j = i-1;
			while (j >= 0 && arr[j] > v) {
				arr[j+1] = arr[j];
				j--;
			}
			arr[j+1] = v;
			printArray(arr);
		}
	}
	
	public static void printArray(int[] arr) {
		String ans = "";
		for (int i = 0; i < arr.length; i++) {
			ans += arr[i] + " ";
		}
		System.out.println(ans.trim());
	}
} Main public static void main(String[] args) throws IOException {
		Scanner s = new Scanner(System.in);

		int n = s.nextInt();
		
		int[] arr = new int[n];
		for (int i = 0; i < n; i++) {
			arr[i] = s.nextInt();
		}
		
		printArray(arr);
		insertionSort(arr, n);
	} main {
		Scanner s = new Scanner(System.in);

		int n = s.nextInt();
		
		int[] arr = new int[n];
		for (int i = 0; i < n; i++) {
			arr[i] = s.nextInt();
		}
		
		printArray(arr);
		insertionSort(arr, n);
	} Scanner s = new Scanner(System.in); s new Scanner(System.in) int n = s.nextInt(); n s.nextInt() s.nextInt s int[] arr = new int[n]; arr new int[n] n for (int i = 0; i < n; i++) {
			arr[i] = s.nextInt();
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			arr[i] = s.nextInt();
		} {
			arr[i] = s.nextInt();
		} arr[i] = s.nextInt() arr[i] arr i s.nextInt() s.nextInt s printArray(arr) printArray arr insertionSort(arr, n) insertionSort arr n String[] args args public static void insertionSort(int[] arr, int n) {
		for (int i = 1; i < n; i++) {
			int v = arr[i];
			int j = i-1;
			while (j >= 0 && arr[j] > v) {
				arr[j+1] = arr[j];
				j--;
			}
			arr[j+1] = v;
			printArray(arr);
		}
	} insertionSort {
		for (int i = 1; i < n; i++) {
			int v = arr[i];
			int j = i-1;
			while (j >= 0 && arr[j] > v) {
				arr[j+1] = arr[j];
				j--;
			}
			arr[j+1] = v;
			printArray(arr);
		}
	} for (int i = 1; i < n; i++) {
			int v = arr[i];
			int j = i-1;
			while (j >= 0 && arr[j] > v) {
				arr[j+1] = arr[j];
				j--;
			}
			arr[j+1] = v;
			printArray(arr);
		} int i = 1; int i = 1; i 1 i < n i n i++ i++ i {
			int v = arr[i];
			int j = i-1;
			while (j >= 0 && arr[j] > v) {
				arr[j+1] = arr[j];
				j--;
			}
			arr[j+1] = v;
			printArray(arr);
		} {
			int v = arr[i];
			int j = i-1;
			while (j >= 0 && arr[j] > v) {
				arr[j+1] = arr[j];
				j--;
			}
			arr[j+1] = v;
			printArray(arr);
		} int v = arr[i]; v arr[i] arr i int j = i-1; j i-1 i 1 while (j >= 0 && arr[j] > v) {
				arr[j+1] = arr[j];
				j--;
			} j >= 0 && arr[j] > v j >= 0 j 0 arr[j] > v arr[j] arr j v {
				arr[j+1] = arr[j];
				j--;
			} arr[j+1] = arr[j] arr[j+1] arr j+1 j 1 arr[j] arr j j-- j arr[j+1] = v arr[j+1] arr j+1 j 1 v printArray(arr) printArray arr int[] arr arr int n n public static void printArray(int[] arr) {
		String ans = "";
		for (int i = 0; i < arr.length; i++) {
			ans += arr[i] + " ";
		}
		System.out.println(ans.trim());
	} printArray {
		String ans = "";
		for (int i = 0; i < arr.length; i++) {
			ans += arr[i] + " ";
		}
		System.out.println(ans.trim());
	} String ans = ""; ans "" for (int i = 0; i < arr.length; i++) {
			ans += arr[i] + " ";
		} int i = 0; int i = 0; i 0 i < arr.length i arr.length arr arr.length i++ i++ i {
			ans += arr[i] + " ";
		} {
			ans += arr[i] + " ";
		} ans += arr[i] + " " ans arr[i] + " " arr[i] arr i " " System.out.println(ans.trim()) System.out.println System.out System System.out ans.trim() ans.trim ans int[] arr arr public class Main {
	public static void main(String[] args) throws IOException {
		Scanner s = new Scanner(System.in);

		int n = s.nextInt();
		
		int[] arr = new int[n];
		for (int i = 0; i < n; i++) {
			arr[i] = s.nextInt();
		}
		
		printArray(arr);
		insertionSort(arr, n);
	}
	
	public static void insertionSort(int[] arr, int n) {
		for (int i = 1; i < n; i++) {
			int v = arr[i];
			int j = i-1;
			while (j >= 0 && arr[j] > v) {
				arr[j+1] = arr[j];
				j--;
			}
			arr[j+1] = v;
			printArray(arr);
		}
	}
	
	public static void printArray(int[] arr) {
		String ans = "";
		for (int i = 0; i < arr.length; i++) {
			ans += arr[i] + " ";
		}
		System.out.println(ans.trim());
	}
} public class Main {
	public static void main(String[] args) throws IOException {
		Scanner s = new Scanner(System.in);

		int n = s.nextInt();
		
		int[] arr = new int[n];
		for (int i = 0; i < n; i++) {
			arr[i] = s.nextInt();
		}
		
		printArray(arr);
		insertionSort(arr, n);
	}
	
	public static void insertionSort(int[] arr, int n) {
		for (int i = 1; i < n; i++) {
			int v = arr[i];
			int j = i-1;
			while (j >= 0 && arr[j] > v) {
				arr[j+1] = arr[j];
				j--;
			}
			arr[j+1] = v;
			printArray(arr);
		}
	}
	
	public static void printArray(int[] arr) {
		String ans = "";
		for (int i = 0; i < arr.length; i++) {
			ans += arr[i] + " ";
		}
		System.out.println(ans.trim());
	}
} Main
import java.io.IOException;
import java.util.Scanner;

/**
 * 挿入ソート
 * 
 *
 */

public class Main {
	public static void main(String[] args) throws IOException {
		Scanner s = new Scanner(System.in);

		int n = s.nextInt();
		
		int[] arr = new int[n];
		for (int i = 0; i < n; i++) {
			arr[i] = s.nextInt();
		}
		
		printArray(arr);
		insertionSort(arr, n);
	}
	
	public static void insertionSort(int[] arr, int n) {
		for (int i = 1; i < n; i++) {
			int v = arr[i];
			int j = i-1;
			while (j >= 0 && arr[j] > v) {
				arr[j+1] = arr[j];
				j--;
			}
			arr[j+1] = v;
			printArray(arr);
		}
	}
	
	public static void printArray(int[] arr) {
		String ans = "";
		for (int i = 0; i < arr.length; i++) {
			ans += arr[i] + " ";
		}
		System.out.println(ans.trim());
	}
}
