
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
import java.util.ArrayList;
public class Main {
	public static void main(String[] args) throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		ArrayList<String> lines = new ArrayList<String>();
		while (br.ready()){
			lines.add(br.readLine());
		}
		
		int N = Integer.parseInt(lines.get(0));
		String[] tmp = lines.get(1).split(" ");
		int[] num = new int[tmp.length];
		for(int i=0; i<tmp.length; i++){
			num[i] = Integer.parseInt(tmp[i]);
		}
		sort(num);


	}

	static void sort(int[] num){
		int key;
		for(int i=0; i<num.length; i++){
			key = num[i];
			
			for(int j=i; j>0 && key < num[j-1];j--){
				num[j] = num[j-1];
				num[j-1] = key;
			}
			print(num);
		}
			
	}
	
	static void print(int[] num){
		for(int i=0; i<num.length-1; i++){
			System.out.print(num[i]);
			System.out.print(" ");
		}
		System.out.println(num[num.length-1]);
	}
} import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io import java.io.IOException; IOException java.io import java.util.ArrayList; ArrayList java.util public class Main {
	public static void main(String[] args) throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		ArrayList<String> lines = new ArrayList<String>();
		while (br.ready()){
			lines.add(br.readLine());
		}
		
		int N = Integer.parseInt(lines.get(0));
		String[] tmp = lines.get(1).split(" ");
		int[] num = new int[tmp.length];
		for(int i=0; i<tmp.length; i++){
			num[i] = Integer.parseInt(tmp[i]);
		}
		sort(num);


	}

	static void sort(int[] num){
		int key;
		for(int i=0; i<num.length; i++){
			key = num[i];
			
			for(int j=i; j>0 && key < num[j-1];j--){
				num[j] = num[j-1];
				num[j-1] = key;
			}
			print(num);
		}
			
	}
	
	static void print(int[] num){
		for(int i=0; i<num.length-1; i++){
			System.out.print(num[i]);
			System.out.print(" ");
		}
		System.out.println(num[num.length-1]);
	}
} Main public static void main(String[] args) throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		ArrayList<String> lines = new ArrayList<String>();
		while (br.ready()){
			lines.add(br.readLine());
		}
		
		int N = Integer.parseInt(lines.get(0));
		String[] tmp = lines.get(1).split(" ");
		int[] num = new int[tmp.length];
		for(int i=0; i<tmp.length; i++){
			num[i] = Integer.parseInt(tmp[i]);
		}
		sort(num);


	} main {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		ArrayList<String> lines = new ArrayList<String>();
		while (br.ready()){
			lines.add(br.readLine());
		}
		
		int N = Integer.parseInt(lines.get(0));
		String[] tmp = lines.get(1).split(" ");
		int[] num = new int[tmp.length];
		for(int i=0; i<tmp.length; i++){
			num[i] = Integer.parseInt(tmp[i]);
		}
		sort(num);


	} BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) ArrayList<String> lines = new ArrayList<String>(); lines new ArrayList<String>() while (br.ready()){
			lines.add(br.readLine());
		} br.ready() br.ready br {
			lines.add(br.readLine());
		} lines.add(br.readLine()) lines.add lines br.readLine() br.readLine br int N = Integer.parseInt(lines.get(0)); N Integer.parseInt(lines.get(0)) Integer.parseInt Integer lines.get(0) lines.get lines 0 String[] tmp = lines.get(1).split(" "); tmp lines.get(1).split(" ") lines.get(1).split lines.get(1) lines.get lines 1 " " int[] num = new int[tmp.length]; num new int[tmp.length] tmp.length tmp tmp.length for(int i=0; i<tmp.length; i++){
			num[i] = Integer.parseInt(tmp[i]);
		} int i=0; int i=0; i 0 i<tmp.length i tmp.length tmp tmp.length i++ i++ i {
			num[i] = Integer.parseInt(tmp[i]);
		} {
			num[i] = Integer.parseInt(tmp[i]);
		} num[i] = Integer.parseInt(tmp[i]) num[i] num i Integer.parseInt(tmp[i]) Integer.parseInt Integer tmp[i] tmp i sort(num) sort num String[] args args static void sort(int[] num){
		int key;
		for(int i=0; i<num.length; i++){
			key = num[i];
			
			for(int j=i; j>0 && key < num[j-1];j--){
				num[j] = num[j-1];
				num[j-1] = key;
			}
			print(num);
		}
			
	} sort {
		int key;
		for(int i=0; i<num.length; i++){
			key = num[i];
			
			for(int j=i; j>0 && key < num[j-1];j--){
				num[j] = num[j-1];
				num[j-1] = key;
			}
			print(num);
		}
			
	} int key; key for(int i=0; i<num.length; i++){
			key = num[i];
			
			for(int j=i; j>0 && key < num[j-1];j--){
				num[j] = num[j-1];
				num[j-1] = key;
			}
			print(num);
		} int i=0; int i=0; i 0 i<num.length i num.length num num.length i++ i++ i {
			key = num[i];
			
			for(int j=i; j>0 && key < num[j-1];j--){
				num[j] = num[j-1];
				num[j-1] = key;
			}
			print(num);
		} {
			key = num[i];
			
			for(int j=i; j>0 && key < num[j-1];j--){
				num[j] = num[j-1];
				num[j-1] = key;
			}
			print(num);
		} key = num[i] key num[i] num i for(int j=i; j>0 && key < num[j-1];j--){
				num[j] = num[j-1];
				num[j-1] = key;
			} int j=i; int j=i; j i j>0 && key < num[j-1] j>0 j 0 key < num[j-1] key num[j-1] num j-1 j 1 j-- j-- j {
				num[j] = num[j-1];
				num[j-1] = key;
			} {
				num[j] = num[j-1];
				num[j-1] = key;
			} num[j] = num[j-1] num[j] num j num[j-1] num j-1 j 1 num[j-1] = key num[j-1] num j-1 j 1 key print(num) print num int[] num num static void print(int[] num){
		for(int i=0; i<num.length-1; i++){
			System.out.print(num[i]);
			System.out.print(" ");
		}
		System.out.println(num[num.length-1]);
	} print {
		for(int i=0; i<num.length-1; i++){
			System.out.print(num[i]);
			System.out.print(" ");
		}
		System.out.println(num[num.length-1]);
	} for(int i=0; i<num.length-1; i++){
			System.out.print(num[i]);
			System.out.print(" ");
		} int i=0; int i=0; i 0 i<num.length-1 i num.length-1 num.length num num.length 1 i++ i++ i {
			System.out.print(num[i]);
			System.out.print(" ");
		} {
			System.out.print(num[i]);
			System.out.print(" ");
		} System.out.print(num[i]) System.out.print System.out System System.out num[i] num i System.out.print(" ") System.out.print System.out System System.out " " System.out.println(num[num.length-1]) System.out.println System.out System System.out num[num.length-1] num num.length-1 num.length num num.length 1 int[] num num public class Main {
	public static void main(String[] args) throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		ArrayList<String> lines = new ArrayList<String>();
		while (br.ready()){
			lines.add(br.readLine());
		}
		
		int N = Integer.parseInt(lines.get(0));
		String[] tmp = lines.get(1).split(" ");
		int[] num = new int[tmp.length];
		for(int i=0; i<tmp.length; i++){
			num[i] = Integer.parseInt(tmp[i]);
		}
		sort(num);


	}

	static void sort(int[] num){
		int key;
		for(int i=0; i<num.length; i++){
			key = num[i];
			
			for(int j=i; j>0 && key < num[j-1];j--){
				num[j] = num[j-1];
				num[j-1] = key;
			}
			print(num);
		}
			
	}
	
	static void print(int[] num){
		for(int i=0; i<num.length-1; i++){
			System.out.print(num[i]);
			System.out.print(" ");
		}
		System.out.println(num[num.length-1]);
	}
} public class Main {
	public static void main(String[] args) throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		ArrayList<String> lines = new ArrayList<String>();
		while (br.ready()){
			lines.add(br.readLine());
		}
		
		int N = Integer.parseInt(lines.get(0));
		String[] tmp = lines.get(1).split(" ");
		int[] num = new int[tmp.length];
		for(int i=0; i<tmp.length; i++){
			num[i] = Integer.parseInt(tmp[i]);
		}
		sort(num);


	}

	static void sort(int[] num){
		int key;
		for(int i=0; i<num.length; i++){
			key = num[i];
			
			for(int j=i; j>0 && key < num[j-1];j--){
				num[j] = num[j-1];
				num[j-1] = key;
			}
			print(num);
		}
			
	}
	
	static void print(int[] num){
		for(int i=0; i<num.length-1; i++){
			System.out.print(num[i]);
			System.out.print(" ");
		}
		System.out.println(num[num.length-1]);
	}
} Main

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
import java.util.ArrayList;
public class Main {
	public static void main(String[] args) throws IOException{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		ArrayList<String> lines = new ArrayList<String>();
		while (br.ready()){
			lines.add(br.readLine());
		}
		
		int N = Integer.parseInt(lines.get(0));
		String[] tmp = lines.get(1).split(" ");
		int[] num = new int[tmp.length];
		for(int i=0; i<tmp.length; i++){
			num[i] = Integer.parseInt(tmp[i]);
		}
		sort(num);


	}

	static void sort(int[] num){
		int key;
		for(int i=0; i<num.length; i++){
			key = num[i];
			
			for(int j=i; j>0 && key < num[j-1];j--){
				num[j] = num[j-1];
				num[j-1] = key;
			}
			print(num);
		}
			
	}
	
	static void print(int[] num){
		for(int i=0; i<num.length-1; i++){
			System.out.print(num[i]);
			System.out.print(" ");
		}
		System.out.println(num[num.length-1]);
	}
}