import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws NumberFormatException, IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		String[] strArr = br.readLine().split(" ");
		int[] arr = new int[n];
		for(int i = 0;i < n;i++){
			arr[i] = Integer.parseInt(strArr[i]);
		}

		System.out.println(toString(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;
			System.out.println(toString(arr));
		}

	}

	static String toString(int[] arr){
		StringBuilder sb = new StringBuilder();
		for(int i = 0;i < arr.length - 1;i++){
			sb.append(arr[i]);
			sb.append(" ");
		}
		sb.append(arr[arr.length -1]);
		return sb.toString();
	}
} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io public class Main {

	public static void main(String[] args) throws NumberFormatException, IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		String[] strArr = br.readLine().split(" ");
		int[] arr = new int[n];
		for(int i = 0;i < n;i++){
			arr[i] = Integer.parseInt(strArr[i]);
		}

		System.out.println(toString(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;
			System.out.println(toString(arr));
		}

	}

	static String toString(int[] arr){
		StringBuilder sb = new StringBuilder();
		for(int i = 0;i < arr.length - 1;i++){
			sb.append(arr[i]);
			sb.append(" ");
		}
		sb.append(arr[arr.length -1]);
		return sb.toString();
	}
} Main public static void main(String[] args) throws NumberFormatException, IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		String[] strArr = br.readLine().split(" ");
		int[] arr = new int[n];
		for(int i = 0;i < n;i++){
			arr[i] = Integer.parseInt(strArr[i]);
		}

		System.out.println(toString(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;
			System.out.println(toString(arr));
		}

	} main {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		String[] strArr = br.readLine().split(" ");
		int[] arr = new int[n];
		for(int i = 0;i < n;i++){
			arr[i] = Integer.parseInt(strArr[i]);
		}

		System.out.println(toString(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;
			System.out.println(toString(arr));
		}

	} BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) int n = Integer.parseInt(br.readLine()); n Integer.parseInt(br.readLine()) Integer.parseInt Integer br.readLine() br.readLine br String[] strArr = br.readLine().split(" "); strArr br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " int[] arr = new int[n]; arr new int[n] n for(int i = 0;i < n;i++){
			arr[i] = Integer.parseInt(strArr[i]);
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			arr[i] = Integer.parseInt(strArr[i]);
		} {
			arr[i] = Integer.parseInt(strArr[i]);
		} arr[i] = Integer.parseInt(strArr[i]) arr[i] arr i Integer.parseInt(strArr[i]) Integer.parseInt Integer strArr[i] strArr i System.out.println(toString(arr)) System.out.println System.out System System.out toString(arr) toString 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;
			System.out.println(toString(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;
			System.out.println(toString(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;
			System.out.println(toString(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 System.out.println(toString(arr)) System.out.println System.out System System.out toString(arr) toString arr String[] args args static String toString(int[] arr){
		StringBuilder sb = new StringBuilder();
		for(int i = 0;i < arr.length - 1;i++){
			sb.append(arr[i]);
			sb.append(" ");
		}
		sb.append(arr[arr.length -1]);
		return sb.toString();
	} toString {
		StringBuilder sb = new StringBuilder();
		for(int i = 0;i < arr.length - 1;i++){
			sb.append(arr[i]);
			sb.append(" ");
		}
		sb.append(arr[arr.length -1]);
		return sb.toString();
	} StringBuilder sb = new StringBuilder(); sb new StringBuilder() for(int i = 0;i < arr.length - 1;i++){
			sb.append(arr[i]);
			sb.append(" ");
		} int i = 0; int i = 0; i 0 i < arr.length - 1 i arr.length - 1 arr.length arr arr.length 1 i++ i++ i {
			sb.append(arr[i]);
			sb.append(" ");
		} {
			sb.append(arr[i]);
			sb.append(" ");
		} sb.append(arr[i]) sb.append sb arr[i] arr i sb.append(" ") sb.append sb " " sb.append(arr[arr.length -1]) sb.append sb arr[arr.length -1] arr arr.length -1 arr.length arr arr.length 1 return sb.toString(); sb.toString() sb.toString sb int[] arr arr public class Main {

	public static void main(String[] args) throws NumberFormatException, IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		String[] strArr = br.readLine().split(" ");
		int[] arr = new int[n];
		for(int i = 0;i < n;i++){
			arr[i] = Integer.parseInt(strArr[i]);
		}

		System.out.println(toString(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;
			System.out.println(toString(arr));
		}

	}

	static String toString(int[] arr){
		StringBuilder sb = new StringBuilder();
		for(int i = 0;i < arr.length - 1;i++){
			sb.append(arr[i]);
			sb.append(" ");
		}
		sb.append(arr[arr.length -1]);
		return sb.toString();
	}
} public class Main {

	public static void main(String[] args) throws NumberFormatException, IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		String[] strArr = br.readLine().split(" ");
		int[] arr = new int[n];
		for(int i = 0;i < n;i++){
			arr[i] = Integer.parseInt(strArr[i]);
		}

		System.out.println(toString(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;
			System.out.println(toString(arr));
		}

	}

	static String toString(int[] arr){
		StringBuilder sb = new StringBuilder();
		for(int i = 0;i < arr.length - 1;i++){
			sb.append(arr[i]);
			sb.append(" ");
		}
		sb.append(arr[arr.length -1]);
		return sb.toString();
	}
} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws NumberFormatException, IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		String[] strArr = br.readLine().split(" ");
		int[] arr = new int[n];
		for(int i = 0;i < n;i++){
			arr[i] = Integer.parseInt(strArr[i]);
		}

		System.out.println(toString(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;
			System.out.println(toString(arr));
		}

	}

	static String toString(int[] arr){
		StringBuilder sb = new StringBuilder();
		for(int i = 0;i < arr.length - 1;i++){
			sb.append(arr[i]);
			sb.append(" ");
		}
		sb.append(arr[arr.length -1]);
		return sb.toString();
	}
}