import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] arr = new int[n];
        for(int i = 0; i < n; i++) {
            arr[i] = sc.nextInt();
        }
        toPrint(arr, n);

        for(int i = 1; i < n; i++) {
            int v = arr[i];
            int j = i - 1;
            while(j >= 0 && arr[j] > v ) {
                arr[j+1] = arr[j];
                j--;
            }
            arr[j+1] = v;
            toPrint(arr, n);
        }

    }

    public static void toPrint(int[] arr, int n) {
        System.out.print(arr[0]);
        for(int i = 1; i < n; i++) {
            System.out.print(" " + arr[i]);
        }
        System.out.println();
    }
} import java.util.*; util.* java public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] arr = new int[n];
        for(int i = 0; i < n; i++) {
            arr[i] = sc.nextInt();
        }
        toPrint(arr, n);

        for(int i = 1; i < n; i++) {
            int v = arr[i];
            int j = i - 1;
            while(j >= 0 && arr[j] > v ) {
                arr[j+1] = arr[j];
                j--;
            }
            arr[j+1] = v;
            toPrint(arr, n);
        }

    }

    public static void toPrint(int[] arr, int n) {
        System.out.print(arr[0]);
        for(int i = 1; i < n; i++) {
            System.out.print(" " + arr[i]);
        }
        System.out.println();
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] arr = new int[n];
        for(int i = 0; i < n; i++) {
            arr[i] = sc.nextInt();
        }
        toPrint(arr, n);

        for(int i = 1; i < n; i++) {
            int v = arr[i];
            int j = i - 1;
            while(j >= 0 && arr[j] > v ) {
                arr[j+1] = arr[j];
                j--;
            }
            arr[j+1] = v;
            toPrint(arr, n);
        }

    } main {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] arr = new int[n];
        for(int i = 0; i < n; i++) {
            arr[i] = sc.nextInt();
        }
        toPrint(arr, n);

        for(int i = 1; i < n; i++) {
            int v = arr[i];
            int j = i - 1;
            while(j >= 0 && arr[j] > v ) {
                arr[j+1] = arr[j];
                j--;
            }
            arr[j+1] = v;
            toPrint(arr, n);
        }

    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int[] arr = new int[n]; arr new int[n] n for(int i = 0; i < n; i++) {
            arr[i] = sc.nextInt();
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            arr[i] = sc.nextInt();
        } {
            arr[i] = sc.nextInt();
        } arr[i] = sc.nextInt() arr[i] arr i sc.nextInt() sc.nextInt sc toPrint(arr, n) toPrint arr n for(int i = 1; i < n; i++) {
            int v = arr[i];
            int j = i - 1;
            while(j >= 0 && arr[j] > v ) {
                arr[j+1] = arr[j];
                j--;
            }
            arr[j+1] = v;
            toPrint(arr, n);
        } int i = 1; int i = 1; i 1 i < n i n i++ i++ i {
            int v = arr[i];
            int j = i - 1;
            while(j >= 0 && arr[j] > v ) {
                arr[j+1] = arr[j];
                j--;
            }
            arr[j+1] = v;
            toPrint(arr, n);
        } {
            int v = arr[i];
            int j = i - 1;
            while(j >= 0 && arr[j] > v ) {
                arr[j+1] = arr[j];
                j--;
            }
            arr[j+1] = v;
            toPrint(arr, n);
        } int v = arr[i]; v arr[i] arr i int j = i - 1; j i - 1 i 1 while(j >= 0 && arr[j] > v ) {
                arr[j+1] = arr[j];
                j--;
            } j >= 0 && arr[j] > v j >= 0 j 0 arr[j] > v arr[j] arr j v {
                arr[j+1] = arr[j];
                j--;
            } arr[j+1] = arr[j] arr[j+1] arr j+1 j 1 arr[j] arr j j-- j arr[j+1] = v arr[j+1] arr j+1 j 1 v toPrint(arr, n) toPrint arr n String[] args args public static void toPrint(int[] arr, int n) {
        System.out.print(arr[0]);
        for(int i = 1; i < n; i++) {
            System.out.print(" " + arr[i]);
        }
        System.out.println();
    } toPrint {
        System.out.print(arr[0]);
        for(int i = 1; i < n; i++) {
            System.out.print(" " + arr[i]);
        }
        System.out.println();
    } System.out.print(arr[0]) System.out.print System.out System System.out arr[0] arr 0 for(int i = 1; i < n; i++) {
            System.out.print(" " + arr[i]);
        } int i = 1; int i = 1; i 1 i < n i n i++ i++ i {
            System.out.print(" " + arr[i]);
        } {
            System.out.print(" " + arr[i]);
        } System.out.print(" " + arr[i]) System.out.print System.out System System.out " " + arr[i] " " arr[i] arr i System.out.println() System.out.println System.out System System.out int[] arr arr int n n public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] arr = new int[n];
        for(int i = 0; i < n; i++) {
            arr[i] = sc.nextInt();
        }
        toPrint(arr, n);

        for(int i = 1; i < n; i++) {
            int v = arr[i];
            int j = i - 1;
            while(j >= 0 && arr[j] > v ) {
                arr[j+1] = arr[j];
                j--;
            }
            arr[j+1] = v;
            toPrint(arr, n);
        }

    }

    public static void toPrint(int[] arr, int n) {
        System.out.print(arr[0]);
        for(int i = 1; i < n; i++) {
            System.out.print(" " + arr[i]);
        }
        System.out.println();
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] arr = new int[n];
        for(int i = 0; i < n; i++) {
            arr[i] = sc.nextInt();
        }
        toPrint(arr, n);

        for(int i = 1; i < n; i++) {
            int v = arr[i];
            int j = i - 1;
            while(j >= 0 && arr[j] > v ) {
                arr[j+1] = arr[j];
                j--;
            }
            arr[j+1] = v;
            toPrint(arr, n);
        }

    }

    public static void toPrint(int[] arr, int n) {
        System.out.print(arr[0]);
        for(int i = 1; i < n; i++) {
            System.out.print(" " + arr[i]);
        }
        System.out.println();
    }
} Main
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] arr = new int[n];
        for(int i = 0; i < n; i++) {
            arr[i] = sc.nextInt();
        }
        toPrint(arr, n);

        for(int i = 1; i < n; i++) {
            int v = arr[i];
            int j = i - 1;
            while(j >= 0 && arr[j] > v ) {
                arr[j+1] = arr[j];
                j--;
            }
            arr[j+1] = v;
            toPrint(arr, n);
        }

    }

    public static void toPrint(int[] arr, int n) {
        System.out.print(arr[0]);
        for(int i = 1; i < n; i++) {
            System.out.print(" " + arr[i]);
        }
        System.out.println();
    }
}