import java.util.Scanner;

/**
 * 
 */

/**
 * @author kawakami
 *
 */
class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		StringBuilder sb = new StringBuilder();
		Scanner as = new Scanner(System.in);
		int N = 0;
		int v = 0;
		int i = 0;
		int j = 0;
		int A[];
		String str = "";
		
		N = Integer.parseInt(as.next());
		
		A = new int[N];
		
		for(i=0;i<N;i++){
			
			A[i] = Integer.parseInt(as.next());
				
			if(i == N - 1){
				
				sb.append(String.valueOf(A[i]));
				
			}
			else{
			
				sb.append(String.valueOf(A[i])).append(' ');
			
			}
			
		}
		System.out.println(sb.toString());
		
		sb.setLength(0);
		
		for(i=1;i<=N-1;i++){
			
			v = A[i];
			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++){
				
				if(k == N - 1){
					
					sb.append(String.valueOf(A[k]));
					
				}
				else{
				
					sb.append(String.valueOf(A[k])).append(' ');
				
				}
				
			}
			
			System.out.println(sb.toString());
			sb.setLength(0);
			//System.out.println("!!");
			
		}
		
		//System.out.println("::");

	}

} import java.util.Scanner; Scanner java.util class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		StringBuilder sb = new StringBuilder();
		Scanner as = new Scanner(System.in);
		int N = 0;
		int v = 0;
		int i = 0;
		int j = 0;
		int A[];
		String str = "";
		
		N = Integer.parseInt(as.next());
		
		A = new int[N];
		
		for(i=0;i<N;i++){
			
			A[i] = Integer.parseInt(as.next());
				
			if(i == N - 1){
				
				sb.append(String.valueOf(A[i]));
				
			}
			else{
			
				sb.append(String.valueOf(A[i])).append(' ');
			
			}
			
		}
		System.out.println(sb.toString());
		
		sb.setLength(0);
		
		for(i=1;i<=N-1;i++){
			
			v = A[i];
			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++){
				
				if(k == N - 1){
					
					sb.append(String.valueOf(A[k]));
					
				}
				else{
				
					sb.append(String.valueOf(A[k])).append(' ');
				
				}
				
			}
			
			System.out.println(sb.toString());
			sb.setLength(0);
			//System.out.println("!!");
			
		}
		
		//System.out.println("::");

	}

} Main /**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		StringBuilder sb = new StringBuilder();
		Scanner as = new Scanner(System.in);
		int N = 0;
		int v = 0;
		int i = 0;
		int j = 0;
		int A[];
		String str = "";
		
		N = Integer.parseInt(as.next());
		
		A = new int[N];
		
		for(i=0;i<N;i++){
			
			A[i] = Integer.parseInt(as.next());
				
			if(i == N - 1){
				
				sb.append(String.valueOf(A[i]));
				
			}
			else{
			
				sb.append(String.valueOf(A[i])).append(' ');
			
			}
			
		}
		System.out.println(sb.toString());
		
		sb.setLength(0);
		
		for(i=1;i<=N-1;i++){
			
			v = A[i];
			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++){
				
				if(k == N - 1){
					
					sb.append(String.valueOf(A[k]));
					
				}
				else{
				
					sb.append(String.valueOf(A[k])).append(' ');
				
				}
				
			}
			
			System.out.println(sb.toString());
			sb.setLength(0);
			//System.out.println("!!");
			
		}
		
		//System.out.println("::");

	} main {
		// TODO Auto-generated method stub
		StringBuilder sb = new StringBuilder();
		Scanner as = new Scanner(System.in);
		int N = 0;
		int v = 0;
		int i = 0;
		int j = 0;
		int A[];
		String str = "";
		
		N = Integer.parseInt(as.next());
		
		A = new int[N];
		
		for(i=0;i<N;i++){
			
			A[i] = Integer.parseInt(as.next());
				
			if(i == N - 1){
				
				sb.append(String.valueOf(A[i]));
				
			}
			else{
			
				sb.append(String.valueOf(A[i])).append(' ');
			
			}
			
		}
		System.out.println(sb.toString());
		
		sb.setLength(0);
		
		for(i=1;i<=N-1;i++){
			
			v = A[i];
			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++){
				
				if(k == N - 1){
					
					sb.append(String.valueOf(A[k]));
					
				}
				else{
				
					sb.append(String.valueOf(A[k])).append(' ');
				
				}
				
			}
			
			System.out.println(sb.toString());
			sb.setLength(0);
			//System.out.println("!!");
			
		}
		
		//System.out.println("::");

	} StringBuilder sb = new StringBuilder(); sb new StringBuilder() Scanner as = new Scanner(System.in); as new Scanner(System.in) int N = 0; N 0 int v = 0; v 0 int i = 0; i 0 int j = 0; j 0 int A[]; A String str = ""; str "" N = Integer.parseInt(as.next()) N Integer.parseInt(as.next()) Integer.parseInt Integer as.next() as.next as A = new int[N] A new int[N] N for(i=0;i<N;i++){
			
			A[i] = Integer.parseInt(as.next());
				
			if(i == N - 1){
				
				sb.append(String.valueOf(A[i]));
				
			}
			else{
			
				sb.append(String.valueOf(A[i])).append(' ');
			
			}
			
		} i=0; i=0 i 0 i<N i N i++ i++ i {
			
			A[i] = Integer.parseInt(as.next());
				
			if(i == N - 1){
				
				sb.append(String.valueOf(A[i]));
				
			}
			else{
			
				sb.append(String.valueOf(A[i])).append(' ');
			
			}
			
		} {
			
			A[i] = Integer.parseInt(as.next());
				
			if(i == N - 1){
				
				sb.append(String.valueOf(A[i]));
				
			}
			else{
			
				sb.append(String.valueOf(A[i])).append(' ');
			
			}
			
		} A[i] = Integer.parseInt(as.next()) A[i] A i Integer.parseInt(as.next()) Integer.parseInt Integer as.next() as.next as if(i == N - 1){
				
				sb.append(String.valueOf(A[i]));
				
			}
			else{
			
				sb.append(String.valueOf(A[i])).append(' ');
			
			} i == N - 1 i N - 1 N 1 {
				
				sb.append(String.valueOf(A[i]));
				
			} sb.append(String.valueOf(A[i])) sb.append sb String.valueOf(A[i]) String.valueOf String A[i] A i {
			
				sb.append(String.valueOf(A[i])).append(' ');
			
			} sb.append(String.valueOf(A[i])).append(' ') sb.append(String.valueOf(A[i])).append sb.append(String.valueOf(A[i])) sb.append sb String.valueOf(A[i]) String.valueOf String A[i] A i ' ' System.out.println(sb.toString()) System.out.println System.out System System.out sb.toString() sb.toString sb sb.setLength(0) sb.setLength sb 0 for(i=1;i<=N-1;i++){
			
			v = A[i];
			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++){
				
				if(k == N - 1){
					
					sb.append(String.valueOf(A[k]));
					
				}
				else{
				
					sb.append(String.valueOf(A[k])).append(' ');
				
				}
				
			}
			
			System.out.println(sb.toString());
			sb.setLength(0);
			//System.out.println("!!");
			
		} i=1; i=1 i 1 i<=N-1 i N-1 N 1 i++ i++ i {
			
			v = A[i];
			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++){
				
				if(k == N - 1){
					
					sb.append(String.valueOf(A[k]));
					
				}
				else{
				
					sb.append(String.valueOf(A[k])).append(' ');
				
				}
				
			}
			
			System.out.println(sb.toString());
			sb.setLength(0);
			//System.out.println("!!");
			
		} {
			
			v = A[i];
			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++){
				
				if(k == N - 1){
					
					sb.append(String.valueOf(A[k]));
					
				}
				else{
				
					sb.append(String.valueOf(A[k])).append(' ');
				
				}
				
			}
			
			System.out.println(sb.toString());
			sb.setLength(0);
			//System.out.println("!!");
			
		} v = A[i] v A[i] A i 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++){
				
				if(k == N - 1){
					
					sb.append(String.valueOf(A[k]));
					
				}
				else{
				
					sb.append(String.valueOf(A[k])).append(' ');
				
				}
				
			} int k=0; int k=0; k 0 k<N k N k++ k++ k {
				
				if(k == N - 1){
					
					sb.append(String.valueOf(A[k]));
					
				}
				else{
				
					sb.append(String.valueOf(A[k])).append(' ');
				
				}
				
			} {
				
				if(k == N - 1){
					
					sb.append(String.valueOf(A[k]));
					
				}
				else{
				
					sb.append(String.valueOf(A[k])).append(' ');
				
				}
				
			} if(k == N - 1){
					
					sb.append(String.valueOf(A[k]));
					
				}
				else{
				
					sb.append(String.valueOf(A[k])).append(' ');
				
				} k == N - 1 k N - 1 N 1 {
					
					sb.append(String.valueOf(A[k]));
					
				} sb.append(String.valueOf(A[k])) sb.append sb String.valueOf(A[k]) String.valueOf String A[k] A k {
				
					sb.append(String.valueOf(A[k])).append(' ');
				
				} sb.append(String.valueOf(A[k])).append(' ') sb.append(String.valueOf(A[k])).append sb.append(String.valueOf(A[k])) sb.append sb String.valueOf(A[k]) String.valueOf String A[k] A k ' ' System.out.println(sb.toString()) System.out.println System.out System System.out sb.toString() sb.toString sb sb.setLength(0) sb.setLength sb 0 String[] args args
import java.util.Scanner;

/**
 * 
 */

/**
 * @author kawakami
 *
 */
class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		StringBuilder sb = new StringBuilder();
		Scanner as = new Scanner(System.in);
		int N = 0;
		int v = 0;
		int i = 0;
		int j = 0;
		int A[];
		String str = "";
		
		N = Integer.parseInt(as.next());
		
		A = new int[N];
		
		for(i=0;i<N;i++){
			
			A[i] = Integer.parseInt(as.next());
				
			if(i == N - 1){
				
				sb.append(String.valueOf(A[i]));
				
			}
			else{
			
				sb.append(String.valueOf(A[i])).append(' ');
			
			}
			
		}
		System.out.println(sb.toString());
		
		sb.setLength(0);
		
		for(i=1;i<=N-1;i++){
			
			v = A[i];
			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++){
				
				if(k == N - 1){
					
					sb.append(String.valueOf(A[k]));
					
				}
				else{
				
					sb.append(String.valueOf(A[k])).append(' ');
				
				}
				
			}
			
			System.out.println(sb.toString());
			sb.setLength(0);
			//System.out.println("!!");
			
		}
		
		//System.out.println("::");

	}

}