import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
 
 
public class Main {
 
    static int len;
    static int[] arr;
     
    /**
     * @param args
     * @throws IOException 
     */
    public static void main(String[] args) throws IOException {
         
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
         
        int len = Integer.parseInt(reader.readLine());
        int[] arr = new int[len];
         
        String arrStr = reader.readLine();
        StringTokenizer tokenizer = new StringTokenizer(arrStr, " ");
         
        int i = 0;
        while (tokenizer.hasMoreElements()) {
           arr[i++] = Integer.parseInt((String) tokenizer.nextElement());
        }
         
//        System.out.println("len" + len);
//        System.out.println("arr" + Arrays.toString(arr));
         
        reader.close();
         
         
        sort(arr);
    }
     
    public static void sort(int[] arr){
         
        printArr(arr);
         
        for (int i = 1; i < arr.length; i++) {
             
            for (int j = i; j >= 1; j--) {
                 
                int current = arr[j];
                int prev = arr[j - 1];
                 
                if(current < prev){
                    swap(arr, j - 1, j);                
                }
                else{
                    break;
                }
            }
             
            printArr(arr);
        }
    }
     
    public static void swap(int[] arr, int from, int to){
        int temp = arr[from];
        arr[from] =  arr[to];
        arr[to] = temp;
     }
     
     
    static void printArr(int[] arr){
        String msg = "";
        for (int i = 0; i < arr.length; i++) {
            msg += arr[i];
            if(i == arr.length -1){
                break;
            }
            msg += " ";
        }
         
        System.out.println(msg);
    }
     
     
} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io import java.util.StringTokenizer; StringTokenizer java.util public class Main {
 
    static int len;
    static int[] arr;
     
    /**
     * @param args
     * @throws IOException 
     */
    public static void main(String[] args) throws IOException {
         
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
         
        int len = Integer.parseInt(reader.readLine());
        int[] arr = new int[len];
         
        String arrStr = reader.readLine();
        StringTokenizer tokenizer = new StringTokenizer(arrStr, " ");
         
        int i = 0;
        while (tokenizer.hasMoreElements()) {
           arr[i++] = Integer.parseInt((String) tokenizer.nextElement());
        }
         
//        System.out.println("len" + len);
//        System.out.println("arr" + Arrays.toString(arr));
         
        reader.close();
         
         
        sort(arr);
    }
     
    public static void sort(int[] arr){
         
        printArr(arr);
         
        for (int i = 1; i < arr.length; i++) {
             
            for (int j = i; j >= 1; j--) {
                 
                int current = arr[j];
                int prev = arr[j - 1];
                 
                if(current < prev){
                    swap(arr, j - 1, j);                
                }
                else{
                    break;
                }
            }
             
            printArr(arr);
        }
    }
     
    public static void swap(int[] arr, int from, int to){
        int temp = arr[from];
        arr[from] =  arr[to];
        arr[to] = temp;
     }
     
     
    static void printArr(int[] arr){
        String msg = "";
        for (int i = 0; i < arr.length; i++) {
            msg += arr[i];
            if(i == arr.length -1){
                break;
            }
            msg += " ";
        }
         
        System.out.println(msg);
    }
     
     
} Main static int len; len static int[] arr; arr /**
     * @param args
     * @throws IOException 
     */
    public static void main(String[] args) throws IOException {
         
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
         
        int len = Integer.parseInt(reader.readLine());
        int[] arr = new int[len];
         
        String arrStr = reader.readLine();
        StringTokenizer tokenizer = new StringTokenizer(arrStr, " ");
         
        int i = 0;
        while (tokenizer.hasMoreElements()) {
           arr[i++] = Integer.parseInt((String) tokenizer.nextElement());
        }
         
//        System.out.println("len" + len);
//        System.out.println("arr" + Arrays.toString(arr));
         
        reader.close();
         
         
        sort(arr);
    } main {
         
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
         
        int len = Integer.parseInt(reader.readLine());
        int[] arr = new int[len];
         
        String arrStr = reader.readLine();
        StringTokenizer tokenizer = new StringTokenizer(arrStr, " ");
         
        int i = 0;
        while (tokenizer.hasMoreElements()) {
           arr[i++] = Integer.parseInt((String) tokenizer.nextElement());
        }
         
//        System.out.println("len" + len);
//        System.out.println("arr" + Arrays.toString(arr));
         
        reader.close();
         
         
        sort(arr);
    } BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); reader new BufferedReader(new InputStreamReader(System.in)) int len = Integer.parseInt(reader.readLine()); len Integer.parseInt(reader.readLine()) Integer.parseInt Integer reader.readLine() reader.readLine reader int[] arr = new int[len]; arr new int[len] len String arrStr = reader.readLine(); arrStr reader.readLine() reader.readLine reader StringTokenizer tokenizer = new StringTokenizer(arrStr, " "); tokenizer new StringTokenizer(arrStr, " ") int i = 0; i 0 while (tokenizer.hasMoreElements()) {
           arr[i++] = Integer.parseInt((String) tokenizer.nextElement());
        } tokenizer.hasMoreElements() tokenizer.hasMoreElements tokenizer {
           arr[i++] = Integer.parseInt((String) tokenizer.nextElement());
        } arr[i++] = Integer.parseInt((String) tokenizer.nextElement()) arr[i++] arr i++ i Integer.parseInt((String) tokenizer.nextElement()) Integer.parseInt Integer (String) tokenizer.nextElement() tokenizer.nextElement tokenizer reader.close() reader.close reader sort(arr) sort arr String[] args args public static void sort(int[] arr){
         
        printArr(arr);
         
        for (int i = 1; i < arr.length; i++) {
             
            for (int j = i; j >= 1; j--) {
                 
                int current = arr[j];
                int prev = arr[j - 1];
                 
                if(current < prev){
                    swap(arr, j - 1, j);                
                }
                else{
                    break;
                }
            }
             
            printArr(arr);
        }
    } sort {
         
        printArr(arr);
         
        for (int i = 1; i < arr.length; i++) {
             
            for (int j = i; j >= 1; j--) {
                 
                int current = arr[j];
                int prev = arr[j - 1];
                 
                if(current < prev){
                    swap(arr, j - 1, j);                
                }
                else{
                    break;
                }
            }
             
            printArr(arr);
        }
    } printArr(arr) printArr arr for (int i = 1; i < arr.length; i++) {
             
            for (int j = i; j >= 1; j--) {
                 
                int current = arr[j];
                int prev = arr[j - 1];
                 
                if(current < prev){
                    swap(arr, j - 1, j);                
                }
                else{
                    break;
                }
            }
             
            printArr(arr);
        } int i = 1; int i = 1; i 1 i < arr.length i arr.length arr arr.length i++ i++ i {
             
            for (int j = i; j >= 1; j--) {
                 
                int current = arr[j];
                int prev = arr[j - 1];
                 
                if(current < prev){
                    swap(arr, j - 1, j);                
                }
                else{
                    break;
                }
            }
             
            printArr(arr);
        } {
             
            for (int j = i; j >= 1; j--) {
                 
                int current = arr[j];
                int prev = arr[j - 1];
                 
                if(current < prev){
                    swap(arr, j - 1, j);                
                }
                else{
                    break;
                }
            }
             
            printArr(arr);
        } for (int j = i; j >= 1; j--) {
                 
                int current = arr[j];
                int prev = arr[j - 1];
                 
                if(current < prev){
                    swap(arr, j - 1, j);                
                }
                else{
                    break;
                }
            } int j = i; int j = i; j i j >= 1 j 1 j-- j-- j {
                 
                int current = arr[j];
                int prev = arr[j - 1];
                 
                if(current < prev){
                    swap(arr, j - 1, j);                
                }
                else{
                    break;
                }
            } {
                 
                int current = arr[j];
                int prev = arr[j - 1];
                 
                if(current < prev){
                    swap(arr, j - 1, j);                
                }
                else{
                    break;
                }
            } int current = arr[j]; current arr[j] arr j int prev = arr[j - 1]; prev arr[j - 1] arr j - 1 j 1 if(current < prev){
                    swap(arr, j - 1, j);                
                }
                else{
                    break;
                } current < prev current prev {
                    swap(arr, j - 1, j);                
                } swap(arr, j - 1, j) swap arr j - 1 j 1 j {
                    break;
                } break; printArr(arr) printArr arr int[] arr arr public static void swap(int[] arr, int from, int to){
        int temp = arr[from];
        arr[from] =  arr[to];
        arr[to] = temp;
     } swap {
        int temp = arr[from];
        arr[from] =  arr[to];
        arr[to] = temp;
     } int temp = arr[from]; temp arr[from] arr from arr[from] =  arr[to] arr[from] arr from arr[to] arr to arr[to] = temp arr[to] arr to temp int[] arr arr int from from int to to static void printArr(int[] arr){
        String msg = "";
        for (int i = 0; i < arr.length; i++) {
            msg += arr[i];
            if(i == arr.length -1){
                break;
            }
            msg += " ";
        }
         
        System.out.println(msg);
    } printArr {
        String msg = "";
        for (int i = 0; i < arr.length; i++) {
            msg += arr[i];
            if(i == arr.length -1){
                break;
            }
            msg += " ";
        }
         
        System.out.println(msg);
    } String msg = ""; msg "" for (int i = 0; i < arr.length; i++) {
            msg += arr[i];
            if(i == arr.length -1){
                break;
            }
            msg += " ";
        } int i = 0; int i = 0; i 0 i < arr.length i arr.length arr arr.length i++ i++ i {
            msg += arr[i];
            if(i == arr.length -1){
                break;
            }
            msg += " ";
        } {
            msg += arr[i];
            if(i == arr.length -1){
                break;
            }
            msg += " ";
        } msg += arr[i] msg arr[i] arr i if(i == arr.length -1){
                break;
            } i == arr.length -1 i arr.length -1 arr.length arr arr.length 1 {
                break;
            } break; msg += " " msg " " System.out.println(msg) System.out.println System.out System System.out msg int[] arr arr public class Main {
 
    static int len;
    static int[] arr;
     
    /**
     * @param args
     * @throws IOException 
     */
    public static void main(String[] args) throws IOException {
         
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
         
        int len = Integer.parseInt(reader.readLine());
        int[] arr = new int[len];
         
        String arrStr = reader.readLine();
        StringTokenizer tokenizer = new StringTokenizer(arrStr, " ");
         
        int i = 0;
        while (tokenizer.hasMoreElements()) {
           arr[i++] = Integer.parseInt((String) tokenizer.nextElement());
        }
         
//        System.out.println("len" + len);
//        System.out.println("arr" + Arrays.toString(arr));
         
        reader.close();
         
         
        sort(arr);
    }
     
    public static void sort(int[] arr){
         
        printArr(arr);
         
        for (int i = 1; i < arr.length; i++) {
             
            for (int j = i; j >= 1; j--) {
                 
                int current = arr[j];
                int prev = arr[j - 1];
                 
                if(current < prev){
                    swap(arr, j - 1, j);                
                }
                else{
                    break;
                }
            }
             
            printArr(arr);
        }
    }
     
    public static void swap(int[] arr, int from, int to){
        int temp = arr[from];
        arr[from] =  arr[to];
        arr[to] = temp;
     }
     
     
    static void printArr(int[] arr){
        String msg = "";
        for (int i = 0; i < arr.length; i++) {
            msg += arr[i];
            if(i == arr.length -1){
                break;
            }
            msg += " ";
        }
         
        System.out.println(msg);
    }
     
     
} public class Main {
 
    static int len;
    static int[] arr;
     
    /**
     * @param args
     * @throws IOException 
     */
    public static void main(String[] args) throws IOException {
         
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
         
        int len = Integer.parseInt(reader.readLine());
        int[] arr = new int[len];
         
        String arrStr = reader.readLine();
        StringTokenizer tokenizer = new StringTokenizer(arrStr, " ");
         
        int i = 0;
        while (tokenizer.hasMoreElements()) {
           arr[i++] = Integer.parseInt((String) tokenizer.nextElement());
        }
         
//        System.out.println("len" + len);
//        System.out.println("arr" + Arrays.toString(arr));
         
        reader.close();
         
         
        sort(arr);
    }
     
    public static void sort(int[] arr){
         
        printArr(arr);
         
        for (int i = 1; i < arr.length; i++) {
             
            for (int j = i; j >= 1; j--) {
                 
                int current = arr[j];
                int prev = arr[j - 1];
                 
                if(current < prev){
                    swap(arr, j - 1, j);                
                }
                else{
                    break;
                }
            }
             
            printArr(arr);
        }
    }
     
    public static void swap(int[] arr, int from, int to){
        int temp = arr[from];
        arr[from] =  arr[to];
        arr[to] = temp;
     }
     
     
    static void printArr(int[] arr){
        String msg = "";
        for (int i = 0; i < arr.length; i++) {
            msg += arr[i];
            if(i == arr.length -1){
                break;
            }
            msg += " ";
        }
         
        System.out.println(msg);
    }
     
     
} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
 
 
public class Main {
 
    static int len;
    static int[] arr;
     
    /**
     * @param args
     * @throws IOException 
     */
    public static void main(String[] args) throws IOException {
         
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
         
        int len = Integer.parseInt(reader.readLine());
        int[] arr = new int[len];
         
        String arrStr = reader.readLine();
        StringTokenizer tokenizer = new StringTokenizer(arrStr, " ");
         
        int i = 0;
        while (tokenizer.hasMoreElements()) {
           arr[i++] = Integer.parseInt((String) tokenizer.nextElement());
        }
         
//        System.out.println("len" + len);
//        System.out.println("arr" + Arrays.toString(arr));
         
        reader.close();
         
         
        sort(arr);
    }
     
    public static void sort(int[] arr){
         
        printArr(arr);
         
        for (int i = 1; i < arr.length; i++) {
             
            for (int j = i; j >= 1; j--) {
                 
                int current = arr[j];
                int prev = arr[j - 1];
                 
                if(current < prev){
                    swap(arr, j - 1, j);                
                }
                else{
                    break;
                }
            }
             
            printArr(arr);
        }
    }
     
    public static void swap(int[] arr, int from, int to){
        int temp = arr[from];
        arr[from] =  arr[to];
        arr[to] = temp;
     }
     
     
    static void printArr(int[] arr){
        String msg = "";
        for (int i = 0; i < arr.length; i++) {
            msg += arr[i];
            if(i == arr.length -1){
                break;
            }
            msg += " ";
        }
         
        System.out.println(msg);
    }
     
     
}