
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner std = new Scanner(System.in);
		int n = Integer.parseInt(std.next());
		int array[] = new int[n];

		for (int i=0; i<n; i++){
			array[i] = Integer.parseInt(std.next());
		}
		String outsd = "";
		for (int i=1; i<n; i++){
			outsd = Integer.toString(array[0]);
			for(int id=1; id<n; id++){
				outsd += (" "+array[id]);
			}
			System.out.println(outsd);

			int v = array[i];
			int j = i-1;
			while (j>=0 && array[j] > v){
				array[j+1] = array[j];
				j--;
			}
			array[j+1] = v;
		}
		outsd = Integer.toString(array[0]);
		for(int id=1; id<n; id++){
			outsd += (" "+array[id]);
		}
		System.out.println(outsd);
	}
} import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args){
		Scanner std = new Scanner(System.in);
		int n = Integer.parseInt(std.next());
		int array[] = new int[n];

		for (int i=0; i<n; i++){
			array[i] = Integer.parseInt(std.next());
		}
		String outsd = "";
		for (int i=1; i<n; i++){
			outsd = Integer.toString(array[0]);
			for(int id=1; id<n; id++){
				outsd += (" "+array[id]);
			}
			System.out.println(outsd);

			int v = array[i];
			int j = i-1;
			while (j>=0 && array[j] > v){
				array[j+1] = array[j];
				j--;
			}
			array[j+1] = v;
		}
		outsd = Integer.toString(array[0]);
		for(int id=1; id<n; id++){
			outsd += (" "+array[id]);
		}
		System.out.println(outsd);
	}
} Main public static void main(String[] args){
		Scanner std = new Scanner(System.in);
		int n = Integer.parseInt(std.next());
		int array[] = new int[n];

		for (int i=0; i<n; i++){
			array[i] = Integer.parseInt(std.next());
		}
		String outsd = "";
		for (int i=1; i<n; i++){
			outsd = Integer.toString(array[0]);
			for(int id=1; id<n; id++){
				outsd += (" "+array[id]);
			}
			System.out.println(outsd);

			int v = array[i];
			int j = i-1;
			while (j>=0 && array[j] > v){
				array[j+1] = array[j];
				j--;
			}
			array[j+1] = v;
		}
		outsd = Integer.toString(array[0]);
		for(int id=1; id<n; id++){
			outsd += (" "+array[id]);
		}
		System.out.println(outsd);
	} main {
		Scanner std = new Scanner(System.in);
		int n = Integer.parseInt(std.next());
		int array[] = new int[n];

		for (int i=0; i<n; i++){
			array[i] = Integer.parseInt(std.next());
		}
		String outsd = "";
		for (int i=1; i<n; i++){
			outsd = Integer.toString(array[0]);
			for(int id=1; id<n; id++){
				outsd += (" "+array[id]);
			}
			System.out.println(outsd);

			int v = array[i];
			int j = i-1;
			while (j>=0 && array[j] > v){
				array[j+1] = array[j];
				j--;
			}
			array[j+1] = v;
		}
		outsd = Integer.toString(array[0]);
		for(int id=1; id<n; id++){
			outsd += (" "+array[id]);
		}
		System.out.println(outsd);
	} Scanner std = new Scanner(System.in); std new Scanner(System.in) int n = Integer.parseInt(std.next()); n Integer.parseInt(std.next()) Integer.parseInt Integer std.next() std.next std int array[] = new int[n]; array new int[n] n for (int i=0; i<n; i++){
			array[i] = Integer.parseInt(std.next());
		} int i=0; int i=0; i 0 i<n i n i++ i++ i {
			array[i] = Integer.parseInt(std.next());
		} {
			array[i] = Integer.parseInt(std.next());
		} array[i] = Integer.parseInt(std.next()) array[i] array i Integer.parseInt(std.next()) Integer.parseInt Integer std.next() std.next std String outsd = ""; outsd "" for (int i=1; i<n; i++){
			outsd = Integer.toString(array[0]);
			for(int id=1; id<n; id++){
				outsd += (" "+array[id]);
			}
			System.out.println(outsd);

			int v = array[i];
			int j = i-1;
			while (j>=0 && array[j] > v){
				array[j+1] = array[j];
				j--;
			}
			array[j+1] = v;
		} int i=1; int i=1; i 1 i<n i n i++ i++ i {
			outsd = Integer.toString(array[0]);
			for(int id=1; id<n; id++){
				outsd += (" "+array[id]);
			}
			System.out.println(outsd);

			int v = array[i];
			int j = i-1;
			while (j>=0 && array[j] > v){
				array[j+1] = array[j];
				j--;
			}
			array[j+1] = v;
		} {
			outsd = Integer.toString(array[0]);
			for(int id=1; id<n; id++){
				outsd += (" "+array[id]);
			}
			System.out.println(outsd);

			int v = array[i];
			int j = i-1;
			while (j>=0 && array[j] > v){
				array[j+1] = array[j];
				j--;
			}
			array[j+1] = v;
		} outsd = Integer.toString(array[0]) outsd Integer.toString(array[0]) Integer.toString Integer array[0] array 0 for(int id=1; id<n; id++){
				outsd += (" "+array[id]);
			} int id=1; int id=1; id 1 id<n id n id++ id++ id {
				outsd += (" "+array[id]);
			} {
				outsd += (" "+array[id]);
			} outsd += (" "+array[id]) outsd (" "+array[id]) " " array[id] array id System.out.println(outsd) System.out.println System.out System System.out outsd int v = array[i]; v array[i] array i int j = i-1; j i-1 i 1 while (j>=0 && array[j] > v){
				array[j+1] = array[j];
				j--;
			} j>=0 && array[j] > v j>=0 j 0 array[j] > v array[j] array j v {
				array[j+1] = array[j];
				j--;
			} array[j+1] = array[j] array[j+1] array j+1 j 1 array[j] array j j-- j array[j+1] = v array[j+1] array j+1 j 1 v outsd = Integer.toString(array[0]) outsd Integer.toString(array[0]) Integer.toString Integer array[0] array 0 for(int id=1; id<n; id++){
			outsd += (" "+array[id]);
		} int id=1; int id=1; id 1 id<n id n id++ id++ id {
			outsd += (" "+array[id]);
		} {
			outsd += (" "+array[id]);
		} outsd += (" "+array[id]) outsd (" "+array[id]) " " array[id] array id System.out.println(outsd) System.out.println System.out System System.out outsd String[] args args public class Main {
	public static void main(String[] args){
		Scanner std = new Scanner(System.in);
		int n = Integer.parseInt(std.next());
		int array[] = new int[n];

		for (int i=0; i<n; i++){
			array[i] = Integer.parseInt(std.next());
		}
		String outsd = "";
		for (int i=1; i<n; i++){
			outsd = Integer.toString(array[0]);
			for(int id=1; id<n; id++){
				outsd += (" "+array[id]);
			}
			System.out.println(outsd);

			int v = array[i];
			int j = i-1;
			while (j>=0 && array[j] > v){
				array[j+1] = array[j];
				j--;
			}
			array[j+1] = v;
		}
		outsd = Integer.toString(array[0]);
		for(int id=1; id<n; id++){
			outsd += (" "+array[id]);
		}
		System.out.println(outsd);
	}
} public class Main {
	public static void main(String[] args){
		Scanner std = new Scanner(System.in);
		int n = Integer.parseInt(std.next());
		int array[] = new int[n];

		for (int i=0; i<n; i++){
			array[i] = Integer.parseInt(std.next());
		}
		String outsd = "";
		for (int i=1; i<n; i++){
			outsd = Integer.toString(array[0]);
			for(int id=1; id<n; id++){
				outsd += (" "+array[id]);
			}
			System.out.println(outsd);

			int v = array[i];
			int j = i-1;
			while (j>=0 && array[j] > v){
				array[j+1] = array[j];
				j--;
			}
			array[j+1] = v;
		}
		outsd = Integer.toString(array[0]);
		for(int id=1; id<n; id++){
			outsd += (" "+array[id]);
		}
		System.out.println(outsd);
	}
} Main

import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner std = new Scanner(System.in);
		int n = Integer.parseInt(std.next());
		int array[] = new int[n];

		for (int i=0; i<n; i++){
			array[i] = Integer.parseInt(std.next());
		}
		String outsd = "";
		for (int i=1; i<n; i++){
			outsd = Integer.toString(array[0]);
			for(int id=1; id<n; id++){
				outsd += (" "+array[id]);
			}
			System.out.println(outsd);

			int v = array[i];
			int j = i-1;
			while (j>=0 && array[j] > v){
				array[j+1] = array[j];
				j--;
			}
			array[j+1] = v;
		}
		outsd = Integer.toString(array[0]);
		for(int id=1; id<n; id++){
			outsd += (" "+array[id]);
		}
		System.out.println(outsd);
	}
}