import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
 
public class Main {
    
    public static void main(String[] args)throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        int[] array = new int[n];
        String[] strArray = br.readLine().split(" ");
        
        for(int i=0; i<n; i++){
            array[i] = Integer.parseInt(strArray[i]);
        }
        insertionSort(array, n);
    }
    
    public static void insertionSort(int[] A, int N){
        for(int i = 0; i < N; i++){
            int key = A[i];
            int j = i - 1;
            while (j >= 0 && A[j] > key){
                A[j + 1] = A[j];
                j--;
            }
            A[j + 1] = key;
            toArray(A);
        }
    }
    
    public static void toArray(int[] out) {
        StringBuilder sb = new StringBuilder();
        for(int i=0; i < out.length; i++){
            sb.append(out[i]);
            if(i < out.length - 1)
                sb.append(" ");
        }
        System.out.println(sb.toString());
    }
} 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 IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        int[] array = new int[n];
        String[] strArray = br.readLine().split(" ");
        
        for(int i=0; i<n; i++){
            array[i] = Integer.parseInt(strArray[i]);
        }
        insertionSort(array, n);
    }
    
    public static void insertionSort(int[] A, int N){
        for(int i = 0; i < N; i++){
            int key = A[i];
            int j = i - 1;
            while (j >= 0 && A[j] > key){
                A[j + 1] = A[j];
                j--;
            }
            A[j + 1] = key;
            toArray(A);
        }
    }
    
    public static void toArray(int[] out) {
        StringBuilder sb = new StringBuilder();
        for(int i=0; i < out.length; i++){
            sb.append(out[i]);
            if(i < out.length - 1)
                sb.append(" ");
        }
        System.out.println(sb.toString());
    }
} Main public static void main(String[] args)throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        int[] array = new int[n];
        String[] strArray = br.readLine().split(" ");
        
        for(int i=0; i<n; i++){
            array[i] = Integer.parseInt(strArray[i]);
        }
        insertionSort(array, n);
    } main {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        int[] array = new int[n];
        String[] strArray = br.readLine().split(" ");
        
        for(int i=0; i<n; i++){
            array[i] = Integer.parseInt(strArray[i]);
        }
        insertionSort(array, n);
    } 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[] array = new int[n]; array new int[n] n String[] strArray = br.readLine().split(" "); strArray br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " for(int i=0; i<n; i++){
            array[i] = Integer.parseInt(strArray[i]);
        } int i=0; int i=0; i 0 i<n i n i++ i++ i {
            array[i] = Integer.parseInt(strArray[i]);
        } {
            array[i] = Integer.parseInt(strArray[i]);
        } array[i] = Integer.parseInt(strArray[i]) array[i] array i Integer.parseInt(strArray[i]) Integer.parseInt Integer strArray[i] strArray i insertionSort(array, n) insertionSort array n String[] args args public static void insertionSort(int[] A, int N){
        for(int i = 0; i < N; i++){
            int key = A[i];
            int j = i - 1;
            while (j >= 0 && A[j] > key){
                A[j + 1] = A[j];
                j--;
            }
            A[j + 1] = key;
            toArray(A);
        }
    } insertionSort {
        for(int i = 0; i < N; i++){
            int key = A[i];
            int j = i - 1;
            while (j >= 0 && A[j] > key){
                A[j + 1] = A[j];
                j--;
            }
            A[j + 1] = key;
            toArray(A);
        }
    } for(int i = 0; i < N; i++){
            int key = A[i];
            int j = i - 1;
            while (j >= 0 && A[j] > key){
                A[j + 1] = A[j];
                j--;
            }
            A[j + 1] = key;
            toArray(A);
        } int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
            int key = A[i];
            int j = i - 1;
            while (j >= 0 && A[j] > key){
                A[j + 1] = A[j];
                j--;
            }
            A[j + 1] = key;
            toArray(A);
        } {
            int key = A[i];
            int j = i - 1;
            while (j >= 0 && A[j] > key){
                A[j + 1] = A[j];
                j--;
            }
            A[j + 1] = key;
            toArray(A);
        } int key = A[i]; key A[i] A i int j = i - 1; j i - 1 i 1 while (j >= 0 && A[j] > key){
                A[j + 1] = A[j];
                j--;
            } j >= 0 && A[j] > key j >= 0 j 0 A[j] > key A[j] A j key {
                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] = key A[j + 1] A j + 1 j 1 key toArray(A) toArray A int[] A A int N N public static void toArray(int[] out) {
        StringBuilder sb = new StringBuilder();
        for(int i=0; i < out.length; i++){
            sb.append(out[i]);
            if(i < out.length - 1)
                sb.append(" ");
        }
        System.out.println(sb.toString());
    } toArray {
        StringBuilder sb = new StringBuilder();
        for(int i=0; i < out.length; i++){
            sb.append(out[i]);
            if(i < out.length - 1)
                sb.append(" ");
        }
        System.out.println(sb.toString());
    } StringBuilder sb = new StringBuilder(); sb new StringBuilder() for(int i=0; i < out.length; i++){
            sb.append(out[i]);
            if(i < out.length - 1)
                sb.append(" ");
        } int i=0; int i=0; i 0 i < out.length i out.length out out.length i++ i++ i {
            sb.append(out[i]);
            if(i < out.length - 1)
                sb.append(" ");
        } {
            sb.append(out[i]);
            if(i < out.length - 1)
                sb.append(" ");
        } sb.append(out[i]) sb.append sb out[i] out i if(i < out.length - 1)
                sb.append(" "); i < out.length - 1 i out.length - 1 out.length out out.length 1 sb.append(" ") sb.append sb " " System.out.println(sb.toString()) System.out.println System.out System System.out sb.toString() sb.toString sb int[] out out public class Main {
    
    public static void main(String[] args)throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        int[] array = new int[n];
        String[] strArray = br.readLine().split(" ");
        
        for(int i=0; i<n; i++){
            array[i] = Integer.parseInt(strArray[i]);
        }
        insertionSort(array, n);
    }
    
    public static void insertionSort(int[] A, int N){
        for(int i = 0; i < N; i++){
            int key = A[i];
            int j = i - 1;
            while (j >= 0 && A[j] > key){
                A[j + 1] = A[j];
                j--;
            }
            A[j + 1] = key;
            toArray(A);
        }
    }
    
    public static void toArray(int[] out) {
        StringBuilder sb = new StringBuilder();
        for(int i=0; i < out.length; i++){
            sb.append(out[i]);
            if(i < out.length - 1)
                sb.append(" ");
        }
        System.out.println(sb.toString());
    }
} public class Main {
    
    public static void main(String[] args)throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        int[] array = new int[n];
        String[] strArray = br.readLine().split(" ");
        
        for(int i=0; i<n; i++){
            array[i] = Integer.parseInt(strArray[i]);
        }
        insertionSort(array, n);
    }
    
    public static void insertionSort(int[] A, int N){
        for(int i = 0; i < N; i++){
            int key = A[i];
            int j = i - 1;
            while (j >= 0 && A[j] > key){
                A[j + 1] = A[j];
                j--;
            }
            A[j + 1] = key;
            toArray(A);
        }
    }
    
    public static void toArray(int[] out) {
        StringBuilder sb = new StringBuilder();
        for(int i=0; i < out.length; i++){
            sb.append(out[i]);
            if(i < out.length - 1)
                sb.append(" ");
        }
        System.out.println(sb.toString());
    }
} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
 
public class Main {
    
    public static void main(String[] args)throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        int[] array = new int[n];
        String[] strArray = br.readLine().split(" ");
        
        for(int i=0; i<n; i++){
            array[i] = Integer.parseInt(strArray[i]);
        }
        insertionSort(array, n);
    }
    
    public static void insertionSort(int[] A, int N){
        for(int i = 0; i < N; i++){
            int key = A[i];
            int j = i - 1;
            while (j >= 0 && A[j] > key){
                A[j + 1] = A[j];
                j--;
            }
            A[j + 1] = key;
            toArray(A);
        }
    }
    
    public static void toArray(int[] out) {
        StringBuilder sb = new StringBuilder();
        for(int i=0; i < out.length; i++){
            sb.append(out[i]);
            if(i < out.length - 1)
                sb.append(" ");
        }
        System.out.println(sb.toString());
    }
}