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

public class Main {

	public static void main(String[] args) throws NumberFormatException, IOException {
		// TODO ?????????????????????????????????????????????
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		
		int n = Integer.parseInt(br.readLine());
		int[] A = new int[n];
		
		String[] str = br.readLine().split(" ");
		
		for(int i = 0; i < n; i++){
			A[i] = Integer.parseInt(str[i]);
		}
		
		
		for(int i = 0; i < n; i++){
			System.out.print(A[i]);
			
			if(i + 1 == n){
				System.out.print("\n");
			} else {
				System.out.print(" ");
			}
		}
		
		for(int i = 1; i < n; i++){
			int v = A[i];
			int j = i - 1;
			
			while(j >= 0 && A[j] > v){
				A[j + 1] = A[j];
				j--;
			}
			A[j + 1] = v;
			
			for(int k = 0; k < n; k++){
				System.out.print(A[k]);
				
				if(k + 1 == n){
					System.out.print("\n");
				} else {
					System.out.print(" ");
				}
			}
		}
	}

} 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 {
		// TODO ?????????????????????????????????????????????
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		
		int n = Integer.parseInt(br.readLine());
		int[] A = new int[n];
		
		String[] str = br.readLine().split(" ");
		
		for(int i = 0; i < n; i++){
			A[i] = Integer.parseInt(str[i]);
		}
		
		
		for(int i = 0; i < n; i++){
			System.out.print(A[i]);
			
			if(i + 1 == n){
				System.out.print("\n");
			} else {
				System.out.print(" ");
			}
		}
		
		for(int i = 1; i < n; i++){
			int v = A[i];
			int j = i - 1;
			
			while(j >= 0 && A[j] > v){
				A[j + 1] = A[j];
				j--;
			}
			A[j + 1] = v;
			
			for(int k = 0; k < n; k++){
				System.out.print(A[k]);
				
				if(k + 1 == n){
					System.out.print("\n");
				} else {
					System.out.print(" ");
				}
			}
		}
	}

} Main public static void main(String[] args) throws NumberFormatException, IOException {
		// TODO ?????????????????????????????????????????????
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		
		int n = Integer.parseInt(br.readLine());
		int[] A = new int[n];
		
		String[] str = br.readLine().split(" ");
		
		for(int i = 0; i < n; i++){
			A[i] = Integer.parseInt(str[i]);
		}
		
		
		for(int i = 0; i < n; i++){
			System.out.print(A[i]);
			
			if(i + 1 == n){
				System.out.print("\n");
			} else {
				System.out.print(" ");
			}
		}
		
		for(int i = 1; i < n; i++){
			int v = A[i];
			int j = i - 1;
			
			while(j >= 0 && A[j] > v){
				A[j + 1] = A[j];
				j--;
			}
			A[j + 1] = v;
			
			for(int k = 0; k < n; k++){
				System.out.print(A[k]);
				
				if(k + 1 == n){
					System.out.print("\n");
				} else {
					System.out.print(" ");
				}
			}
		}
	} main {
		// TODO ?????????????????????????????????????????????
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		
		int n = Integer.parseInt(br.readLine());
		int[] A = new int[n];
		
		String[] str = br.readLine().split(" ");
		
		for(int i = 0; i < n; i++){
			A[i] = Integer.parseInt(str[i]);
		}
		
		
		for(int i = 0; i < n; i++){
			System.out.print(A[i]);
			
			if(i + 1 == n){
				System.out.print("\n");
			} else {
				System.out.print(" ");
			}
		}
		
		for(int i = 1; i < n; i++){
			int v = A[i];
			int j = i - 1;
			
			while(j >= 0 && A[j] > v){
				A[j + 1] = A[j];
				j--;
			}
			A[j + 1] = v;
			
			for(int k = 0; k < n; k++){
				System.out.print(A[k]);
				
				if(k + 1 == n){
					System.out.print("\n");
				} else {
					System.out.print(" ");
				}
			}
		}
	} 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 int[] A = new int[n]; A new int[n] n String[] str = br.readLine().split(" "); str br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " for(int i = 0; i < n; i++){
			A[i] = Integer.parseInt(str[i]);
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			A[i] = Integer.parseInt(str[i]);
		} {
			A[i] = Integer.parseInt(str[i]);
		} A[i] = Integer.parseInt(str[i]) A[i] A i Integer.parseInt(str[i]) Integer.parseInt Integer str[i] str i for(int i = 0; i < n; i++){
			System.out.print(A[i]);
			
			if(i + 1 == n){
				System.out.print("\n");
			} else {
				System.out.print(" ");
			}
		} int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
			System.out.print(A[i]);
			
			if(i + 1 == n){
				System.out.print("\n");
			} else {
				System.out.print(" ");
			}
		} {
			System.out.print(A[i]);
			
			if(i + 1 == n){
				System.out.print("\n");
			} else {
				System.out.print(" ");
			}
		} System.out.print(A[i]) System.out.print System.out System System.out A[i] A i if(i + 1 == n){
				System.out.print("\n");
			} else {
				System.out.print(" ");
			} i + 1 == n i + 1 i 1 n {
				System.out.print("\n");
			} System.out.print("\n") System.out.print System.out System System.out "\n" {
				System.out.print(" ");
			} System.out.print(" ") System.out.print System.out System System.out " " for(int i = 1; i < n; i++){
			int v = A[i];
			int j = i - 1;
			
			while(j >= 0 && A[j] > v){
				A[j + 1] = A[j];
				j--;
			}
			A[j + 1] = v;
			
			for(int k = 0; k < n; k++){
				System.out.print(A[k]);
				
				if(k + 1 == n){
					System.out.print("\n");
				} else {
					System.out.print(" ");
				}
			}
		} int i = 1; int i = 1; i 1 i < n i n i++ i++ i {
			int v = A[i];
			int j = i - 1;
			
			while(j >= 0 && A[j] > v){
				A[j + 1] = A[j];
				j--;
			}
			A[j + 1] = v;
			
			for(int k = 0; k < n; k++){
				System.out.print(A[k]);
				
				if(k + 1 == n){
					System.out.print("\n");
				} else {
					System.out.print(" ");
				}
			}
		} {
			int v = A[i];
			int j = i - 1;
			
			while(j >= 0 && A[j] > v){
				A[j + 1] = A[j];
				j--;
			}
			A[j + 1] = v;
			
			for(int k = 0; k < n; k++){
				System.out.print(A[k]);
				
				if(k + 1 == n){
					System.out.print("\n");
				} else {
					System.out.print(" ");
				}
			}
		} int v = A[i]; v A[i] A i int j = i - 1; j i - 1 i 1 while(j >= 0 && A[j] > v){
				A[j + 1] = A[j];
				j--;
			} j >= 0 && A[j] > v j >= 0 j 0 A[j] > v A[j] A j v {
				A[j + 1] = A[j];
				j--;
			} A[j + 1] = A[j] A[j + 1] A j + 1 j 1 A[j] A j j-- j A[j + 1] = v A[j + 1] A j + 1 j 1 v for(int k = 0; k < n; k++){
				System.out.print(A[k]);
				
				if(k + 1 == n){
					System.out.print("\n");
				} else {
					System.out.print(" ");
				}
			} int k = 0; int k = 0; k 0 k < n k n k++ k++ k {
				System.out.print(A[k]);
				
				if(k + 1 == n){
					System.out.print("\n");
				} else {
					System.out.print(" ");
				}
			} {
				System.out.print(A[k]);
				
				if(k + 1 == n){
					System.out.print("\n");
				} else {
					System.out.print(" ");
				}
			} System.out.print(A[k]) System.out.print System.out System System.out A[k] A k if(k + 1 == n){
					System.out.print("\n");
				} else {
					System.out.print(" ");
				} k + 1 == n k + 1 k 1 n {
					System.out.print("\n");
				} System.out.print("\n") System.out.print System.out System System.out "\n" {
					System.out.print(" ");
				} System.out.print(" ") System.out.print System.out System System.out " " String[] args args public class Main {

	public static void main(String[] args) throws NumberFormatException, IOException {
		// TODO ?????????????????????????????????????????????
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		
		int n = Integer.parseInt(br.readLine());
		int[] A = new int[n];
		
		String[] str = br.readLine().split(" ");
		
		for(int i = 0; i < n; i++){
			A[i] = Integer.parseInt(str[i]);
		}
		
		
		for(int i = 0; i < n; i++){
			System.out.print(A[i]);
			
			if(i + 1 == n){
				System.out.print("\n");
			} else {
				System.out.print(" ");
			}
		}
		
		for(int i = 1; i < n; i++){
			int v = A[i];
			int j = i - 1;
			
			while(j >= 0 && A[j] > v){
				A[j + 1] = A[j];
				j--;
			}
			A[j + 1] = v;
			
			for(int k = 0; k < n; k++){
				System.out.print(A[k]);
				
				if(k + 1 == n){
					System.out.print("\n");
				} else {
					System.out.print(" ");
				}
			}
		}
	}

} public class Main {

	public static void main(String[] args) throws NumberFormatException, IOException {
		// TODO ?????????????????????????????????????????????
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		
		int n = Integer.parseInt(br.readLine());
		int[] A = new int[n];
		
		String[] str = br.readLine().split(" ");
		
		for(int i = 0; i < n; i++){
			A[i] = Integer.parseInt(str[i]);
		}
		
		
		for(int i = 0; i < n; i++){
			System.out.print(A[i]);
			
			if(i + 1 == n){
				System.out.print("\n");
			} else {
				System.out.print(" ");
			}
		}
		
		for(int i = 1; i < n; i++){
			int v = A[i];
			int j = i - 1;
			
			while(j >= 0 && A[j] > v){
				A[j + 1] = A[j];
				j--;
			}
			A[j + 1] = v;
			
			for(int k = 0; k < n; k++){
				System.out.print(A[k]);
				
				if(k + 1 == n){
					System.out.print("\n");
				} else {
					System.out.print(" ");
				}
			}
		}
	}

} 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 {
		// TODO ?????????????????????????????????????????????
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		
		int n = Integer.parseInt(br.readLine());
		int[] A = new int[n];
		
		String[] str = br.readLine().split(" ");
		
		for(int i = 0; i < n; i++){
			A[i] = Integer.parseInt(str[i]);
		}
		
		
		for(int i = 0; i < n; i++){
			System.out.print(A[i]);
			
			if(i + 1 == n){
				System.out.print("\n");
			} else {
				System.out.print(" ");
			}
		}
		
		for(int i = 1; i < n; i++){
			int v = A[i];
			int j = i - 1;
			
			while(j >= 0 && A[j] > v){
				A[j + 1] = A[j];
				j--;
			}
			A[j + 1] = v;
			
			for(int k = 0; k < n; k++){
				System.out.print(A[k]);
				
				if(k + 1 == n){
					System.out.print("\n");
				} else {
					System.out.print(" ");
				}
			}
		}
	}

}