import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
	    int length = scanner.nextInt();
		int A[] = new int[length];
        for(int i = 0; i < length; i++)
        	A[i] = scanner.nextInt();
   
        out_put(A);
		int key=1000;
		for (int j = 1; j < length; j++) {
			key = A[j];
			int l = j - 1;
			while (l >= 0 && A[l] > key) {
				A[l + 1] = A[l];
				l--;
			}
			A[l + 1] = key;
			out_put(A);
		}
		
	}
	private static void out_put(int A[]){
		 
        System.out.printf("%d", A[0]);
 
        for(int i = 1; i < A.length; i++){
            System.out.printf(" %d", A[i]);
        }
        System.out.printf("\n");
    }

}
 import java.util.Scanner; Scanner java.util public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
	    int length = scanner.nextInt();
		int A[] = new int[length];
        for(int i = 0; i < length; i++)
        	A[i] = scanner.nextInt();
   
        out_put(A);
		int key=1000;
		for (int j = 1; j < length; j++) {
			key = A[j];
			int l = j - 1;
			while (l >= 0 && A[l] > key) {
				A[l + 1] = A[l];
				l--;
			}
			A[l + 1] = key;
			out_put(A);
		}
		
	}
	private static void out_put(int A[]){
		 
        System.out.printf("%d", A[0]);
 
        for(int i = 1; i < A.length; i++){
            System.out.printf(" %d", A[i]);
        }
        System.out.printf("\n");
    }

} Main public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
	    int length = scanner.nextInt();
		int A[] = new int[length];
        for(int i = 0; i < length; i++)
        	A[i] = scanner.nextInt();
   
        out_put(A);
		int key=1000;
		for (int j = 1; j < length; j++) {
			key = A[j];
			int l = j - 1;
			while (l >= 0 && A[l] > key) {
				A[l + 1] = A[l];
				l--;
			}
			A[l + 1] = key;
			out_put(A);
		}
		
	} main {
		Scanner scanner = new Scanner(System.in);
	    int length = scanner.nextInt();
		int A[] = new int[length];
        for(int i = 0; i < length; i++)
        	A[i] = scanner.nextInt();
   
        out_put(A);
		int key=1000;
		for (int j = 1; j < length; j++) {
			key = A[j];
			int l = j - 1;
			while (l >= 0 && A[l] > key) {
				A[l + 1] = A[l];
				l--;
			}
			A[l + 1] = key;
			out_put(A);
		}
		
	} Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) int length = scanner.nextInt(); length scanner.nextInt() scanner.nextInt scanner int A[] = new int[length]; A new int[length] length for(int i = 0; i < length; i++)
        	A[i] = scanner.nextInt(); int i = 0; int i = 0; i 0 i < length i length i++ i++ i A[i] = scanner.nextInt(); A[i] = scanner.nextInt() A[i] A i scanner.nextInt() scanner.nextInt scanner out_put(A) out_put A int key=1000; key 1000 for (int j = 1; j < length; j++) {
			key = A[j];
			int l = j - 1;
			while (l >= 0 && A[l] > key) {
				A[l + 1] = A[l];
				l--;
			}
			A[l + 1] = key;
			out_put(A);
		} int j = 1; int j = 1; j 1 j < length j length j++ j++ j {
			key = A[j];
			int l = j - 1;
			while (l >= 0 && A[l] > key) {
				A[l + 1] = A[l];
				l--;
			}
			A[l + 1] = key;
			out_put(A);
		} {
			key = A[j];
			int l = j - 1;
			while (l >= 0 && A[l] > key) {
				A[l + 1] = A[l];
				l--;
			}
			A[l + 1] = key;
			out_put(A);
		} key = A[j] key A[j] A j int l = j - 1; l j - 1 j 1 while (l >= 0 && A[l] > key) {
				A[l + 1] = A[l];
				l--;
			} l >= 0 && A[l] > key l >= 0 l 0 A[l] > key A[l] A l key {
				A[l + 1] = A[l];
				l--;
			} A[l + 1] = A[l] A[l + 1] A l + 1 l 1 A[l] A l l-- l A[l + 1] = key A[l + 1] A l + 1 l 1 key out_put(A) out_put A String[] args args private static void out_put(int A[]){
		 
        System.out.printf("%d", A[0]);
 
        for(int i = 1; i < A.length; i++){
            System.out.printf(" %d", A[i]);
        }
        System.out.printf("\n");
    } out_put {
		 
        System.out.printf("%d", A[0]);
 
        for(int i = 1; i < A.length; i++){
            System.out.printf(" %d", A[i]);
        }
        System.out.printf("\n");
    } System.out.printf("%d", A[0]) System.out.printf System.out System System.out "%d" A[0] A 0 for(int i = 1; i < A.length; i++){
            System.out.printf(" %d", A[i]);
        } int i = 1; int i = 1; i 1 i < A.length i A.length A A.length i++ i++ i {
            System.out.printf(" %d", A[i]);
        } {
            System.out.printf(" %d", A[i]);
        } System.out.printf(" %d", A[i]) System.out.printf System.out System System.out " %d" A[i] A i System.out.printf("\n") System.out.printf System.out System System.out "\n" int A[] A public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
	    int length = scanner.nextInt();
		int A[] = new int[length];
        for(int i = 0; i < length; i++)
        	A[i] = scanner.nextInt();
   
        out_put(A);
		int key=1000;
		for (int j = 1; j < length; j++) {
			key = A[j];
			int l = j - 1;
			while (l >= 0 && A[l] > key) {
				A[l + 1] = A[l];
				l--;
			}
			A[l + 1] = key;
			out_put(A);
		}
		
	}
	private static void out_put(int A[]){
		 
        System.out.printf("%d", A[0]);
 
        for(int i = 1; i < A.length; i++){
            System.out.printf(" %d", A[i]);
        }
        System.out.printf("\n");
    }

} public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
	    int length = scanner.nextInt();
		int A[] = new int[length];
        for(int i = 0; i < length; i++)
        	A[i] = scanner.nextInt();
   
        out_put(A);
		int key=1000;
		for (int j = 1; j < length; j++) {
			key = A[j];
			int l = j - 1;
			while (l >= 0 && A[l] > key) {
				A[l + 1] = A[l];
				l--;
			}
			A[l + 1] = key;
			out_put(A);
		}
		
	}
	private static void out_put(int A[]){
		 
        System.out.printf("%d", A[0]);
 
        for(int i = 1; i < A.length; i++){
            System.out.printf(" %d", A[i]);
        }
        System.out.printf("\n");
    }

} Main
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
	    int length = scanner.nextInt();
		int A[] = new int[length];
        for(int i = 0; i < length; i++)
        	A[i] = scanner.nextInt();
   
        out_put(A);
		int key=1000;
		for (int j = 1; j < length; j++) {
			key = A[j];
			int l = j - 1;
			while (l >= 0 && A[l] > key) {
				A[l + 1] = A[l];
				l--;
			}
			A[l + 1] = key;
			out_put(A);
		}
		
	}
	private static void out_put(int A[]){
		 
        System.out.printf("%d", A[0]);
 
        for(int i = 1; i < A.length; i++){
            System.out.printf(" %d", A[i]);
        }
        System.out.printf("\n");
    }

}

