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

public class Main{
    public static void sort(int[] A) {
        int i, j, tmp;
        for (i = 1; i < A.length; i++) {
            tmp = A[i];
            j = i - 1;
            while (j >= 0 && A[j] > tmp) {
                A[j + 1] = A[j];
                j--;
            }
        A[j + 1] = tmp;
        printArray(A);
        }
    }
    
    public static void printArray(int[] A) {
        int i = 0;
        for (int value : A) {
            System.out.print(value);
            if (i != A.length - 1) {
                System.out.print(" ");
            } else {
                System.out.println();
            }
            i++;
        }
    }
    
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int N = Integer.parseInt(br.readLine());
        String str = br.readLine();
        String[] s = str.split(" ");
        int[] array = new int[N];
        for (int i = 0; i < N; i++) {
            array[i] = Integer.parseInt(s[i]);
        }
        
        printArray(array);
        sort(array);
        
    }
} import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io import java.io.IOException; IOException java.io public class Main{
    public static void sort(int[] A) {
        int i, j, tmp;
        for (i = 1; i < A.length; i++) {
            tmp = A[i];
            j = i - 1;
            while (j >= 0 && A[j] > tmp) {
                A[j + 1] = A[j];
                j--;
            }
        A[j + 1] = tmp;
        printArray(A);
        }
    }
    
    public static void printArray(int[] A) {
        int i = 0;
        for (int value : A) {
            System.out.print(value);
            if (i != A.length - 1) {
                System.out.print(" ");
            } else {
                System.out.println();
            }
            i++;
        }
    }
    
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int N = Integer.parseInt(br.readLine());
        String str = br.readLine();
        String[] s = str.split(" ");
        int[] array = new int[N];
        for (int i = 0; i < N; i++) {
            array[i] = Integer.parseInt(s[i]);
        }
        
        printArray(array);
        sort(array);
        
    }
} Main public static void sort(int[] A) {
        int i, j, tmp;
        for (i = 1; i < A.length; i++) {
            tmp = A[i];
            j = i - 1;
            while (j >= 0 && A[j] > tmp) {
                A[j + 1] = A[j];
                j--;
            }
        A[j + 1] = tmp;
        printArray(A);
        }
    } sort {
        int i, j, tmp;
        for (i = 1; i < A.length; i++) {
            tmp = A[i];
            j = i - 1;
            while (j >= 0 && A[j] > tmp) {
                A[j + 1] = A[j];
                j--;
            }
        A[j + 1] = tmp;
        printArray(A);
        }
    } int i i j j tmp; tmp for (i = 1; i < A.length; i++) {
            tmp = A[i];
            j = i - 1;
            while (j >= 0 && A[j] > tmp) {
                A[j + 1] = A[j];
                j--;
            }
        A[j + 1] = tmp;
        printArray(A);
        } i = 1; i = 1 i 1 i < A.length i A.length A A.length i++ i++ i {
            tmp = A[i];
            j = i - 1;
            while (j >= 0 && A[j] > tmp) {
                A[j + 1] = A[j];
                j--;
            }
        A[j + 1] = tmp;
        printArray(A);
        } {
            tmp = A[i];
            j = i - 1;
            while (j >= 0 && A[j] > tmp) {
                A[j + 1] = A[j];
                j--;
            }
        A[j + 1] = tmp;
        printArray(A);
        } tmp = A[i] tmp A[i] A i j = i - 1 j i - 1 i 1 while (j >= 0 && A[j] > tmp) {
                A[j + 1] = A[j];
                j--;
            } j >= 0 && A[j] > tmp j >= 0 j 0 A[j] > tmp A[j] A j tmp {
                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] = tmp A[j + 1] A j + 1 j 1 tmp printArray(A) printArray A int[] A A public static void printArray(int[] A) {
        int i = 0;
        for (int value : A) {
            System.out.print(value);
            if (i != A.length - 1) {
                System.out.print(" ");
            } else {
                System.out.println();
            }
            i++;
        }
    } printArray {
        int i = 0;
        for (int value : A) {
            System.out.print(value);
            if (i != A.length - 1) {
                System.out.print(" ");
            } else {
                System.out.println();
            }
            i++;
        }
    } int i = 0; i 0 for (int value : A) {
            System.out.print(value);
            if (i != A.length - 1) {
                System.out.print(" ");
            } else {
                System.out.println();
            }
            i++;
        } int value A {
            System.out.print(value);
            if (i != A.length - 1) {
                System.out.print(" ");
            } else {
                System.out.println();
            }
            i++;
        } {
            System.out.print(value);
            if (i != A.length - 1) {
                System.out.print(" ");
            } else {
                System.out.println();
            }
            i++;
        } System.out.print(value) System.out.print System.out System System.out value if (i != A.length - 1) {
                System.out.print(" ");
            } else {
                System.out.println();
            } i != A.length - 1 i A.length - 1 A.length A A.length 1 {
                System.out.print(" ");
            } System.out.print(" ") System.out.print System.out System System.out " " {
                System.out.println();
            } System.out.println() System.out.println System.out System System.out i++ i int[] A A public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int N = Integer.parseInt(br.readLine());
        String str = br.readLine();
        String[] s = str.split(" ");
        int[] array = new int[N];
        for (int i = 0; i < N; i++) {
            array[i] = Integer.parseInt(s[i]);
        }
        
        printArray(array);
        sort(array);
        
    } main {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int N = Integer.parseInt(br.readLine());
        String str = br.readLine();
        String[] s = str.split(" ");
        int[] array = new int[N];
        for (int i = 0; i < N; i++) {
            array[i] = Integer.parseInt(s[i]);
        }
        
        printArray(array);
        sort(array);
        
    } 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 String str = br.readLine(); str br.readLine() br.readLine br String[] s = str.split(" "); s str.split(" ") str.split str " " int[] array = new int[N]; array new int[N] N for (int i = 0; i < N; i++) {
            array[i] = Integer.parseInt(s[i]);
        } int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
            array[i] = Integer.parseInt(s[i]);
        } {
            array[i] = Integer.parseInt(s[i]);
        } array[i] = Integer.parseInt(s[i]) array[i] array i Integer.parseInt(s[i]) Integer.parseInt Integer s[i] s i printArray(array) printArray array sort(array) sort array String[] args args public class Main{
    public static void sort(int[] A) {
        int i, j, tmp;
        for (i = 1; i < A.length; i++) {
            tmp = A[i];
            j = i - 1;
            while (j >= 0 && A[j] > tmp) {
                A[j + 1] = A[j];
                j--;
            }
        A[j + 1] = tmp;
        printArray(A);
        }
    }
    
    public static void printArray(int[] A) {
        int i = 0;
        for (int value : A) {
            System.out.print(value);
            if (i != A.length - 1) {
                System.out.print(" ");
            } else {
                System.out.println();
            }
            i++;
        }
    }
    
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int N = Integer.parseInt(br.readLine());
        String str = br.readLine();
        String[] s = str.split(" ");
        int[] array = new int[N];
        for (int i = 0; i < N; i++) {
            array[i] = Integer.parseInt(s[i]);
        }
        
        printArray(array);
        sort(array);
        
    }
} public class Main{
    public static void sort(int[] A) {
        int i, j, tmp;
        for (i = 1; i < A.length; i++) {
            tmp = A[i];
            j = i - 1;
            while (j >= 0 && A[j] > tmp) {
                A[j + 1] = A[j];
                j--;
            }
        A[j + 1] = tmp;
        printArray(A);
        }
    }
    
    public static void printArray(int[] A) {
        int i = 0;
        for (int value : A) {
            System.out.print(value);
            if (i != A.length - 1) {
                System.out.print(" ");
            } else {
                System.out.println();
            }
            i++;
        }
    }
    
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int N = Integer.parseInt(br.readLine());
        String str = br.readLine();
        String[] s = str.split(" ");
        int[] array = new int[N];
        for (int i = 0; i < N; i++) {
            array[i] = Integer.parseInt(s[i]);
        }
        
        printArray(array);
        sort(array);
        
    }
} Main
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;

public class Main{
    public static void sort(int[] A) {
        int i, j, tmp;
        for (i = 1; i < A.length; i++) {
            tmp = A[i];
            j = i - 1;
            while (j >= 0 && A[j] > tmp) {
                A[j + 1] = A[j];
                j--;
            }
        A[j + 1] = tmp;
        printArray(A);
        }
    }
    
    public static void printArray(int[] A) {
        int i = 0;
        for (int value : A) {
            System.out.print(value);
            if (i != A.length - 1) {
                System.out.print(" ");
            } else {
                System.out.println();
            }
            i++;
        }
    }
    
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int N = Integer.parseInt(br.readLine());
        String str = br.readLine();
        String[] s = str.split(" ");
        int[] array = new int[N];
        for (int i = 0; i < N; i++) {
            array[i] = Integer.parseInt(s[i]);
        }
        
        printArray(array);
        sort(array);
        
    }
}
