import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
        }
        // 初期状態（ソート前）の要素を表示
        for (int i = 0; i < a.length; i++) {
            if (i < a.length - 1) {
                System.out.print(a[i] + " ");
            } else {
                System.out.println(a[i]);
            }
        }
        // 挿入ソート
        for (int i = 1; i < n; i++) {
            int v = a[i];
            int j = i - 1;
            for (; j >= 0 && a[j] > v; j--) {
                a[j + 1] = a[j];
            }
            a[j + 1] = v;
            // 表示
            for (int k = 0; k < a.length; k++) {
                if (k < a.length - 1) {
                    System.out.print(a[k] + " ");
                } else {
                    System.out.println(a[k]);
                }
            }
        }

    }

} import java.util.Scanner; Scanner java.util public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
        }
        // 初期状態（ソート前）の要素を表示
        for (int i = 0; i < a.length; i++) {
            if (i < a.length - 1) {
                System.out.print(a[i] + " ");
            } else {
                System.out.println(a[i]);
            }
        }
        // 挿入ソート
        for (int i = 1; i < n; i++) {
            int v = a[i];
            int j = i - 1;
            for (; j >= 0 && a[j] > v; j--) {
                a[j + 1] = a[j];
            }
            a[j + 1] = v;
            // 表示
            for (int k = 0; k < a.length; k++) {
                if (k < a.length - 1) {
                    System.out.print(a[k] + " ");
                } else {
                    System.out.println(a[k]);
                }
            }
        }

    }

} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
        }
        // 初期状態（ソート前）の要素を表示
        for (int i = 0; i < a.length; i++) {
            if (i < a.length - 1) {
                System.out.print(a[i] + " ");
            } else {
                System.out.println(a[i]);
            }
        }
        // 挿入ソート
        for (int i = 1; i < n; i++) {
            int v = a[i];
            int j = i - 1;
            for (; j >= 0 && a[j] > v; j--) {
                a[j + 1] = a[j];
            }
            a[j + 1] = v;
            // 表示
            for (int k = 0; k < a.length; k++) {
                if (k < a.length - 1) {
                    System.out.print(a[k] + " ");
                } else {
                    System.out.println(a[k]);
                }
            }
        }

    } main {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
        }
        // 初期状態（ソート前）の要素を表示
        for (int i = 0; i < a.length; i++) {
            if (i < a.length - 1) {
                System.out.print(a[i] + " ");
            } else {
                System.out.println(a[i]);
            }
        }
        // 挿入ソート
        for (int i = 1; i < n; i++) {
            int v = a[i];
            int j = i - 1;
            for (; j >= 0 && a[j] > v; j--) {
                a[j + 1] = a[j];
            }
            a[j + 1] = v;
            // 表示
            for (int k = 0; k < a.length; k++) {
                if (k < a.length - 1) {
                    System.out.print(a[k] + " ");
                } else {
                    System.out.println(a[k]);
                }
            }
        }

    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int[] a = new int[n]; a new int[n] n for (int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            a[i] = sc.nextInt();
        } {
            a[i] = sc.nextInt();
        } a[i] = sc.nextInt() a[i] a i sc.nextInt() sc.nextInt sc for (int i = 0; i < a.length; i++) {
            if (i < a.length - 1) {
                System.out.print(a[i] + " ");
            } else {
                System.out.println(a[i]);
            }
        } int i = 0; int i = 0; i 0 i < a.length i a.length a a.length i++ i++ i {
            if (i < a.length - 1) {
                System.out.print(a[i] + " ");
            } else {
                System.out.println(a[i]);
            }
        } {
            if (i < a.length - 1) {
                System.out.print(a[i] + " ");
            } else {
                System.out.println(a[i]);
            }
        } if (i < a.length - 1) {
                System.out.print(a[i] + " ");
            } else {
                System.out.println(a[i]);
            } i < a.length - 1 i a.length - 1 a.length a a.length 1 {
                System.out.print(a[i] + " ");
            } System.out.print(a[i] + " ") System.out.print System.out System System.out a[i] + " " a[i] a i " " {
                System.out.println(a[i]);
            } System.out.println(a[i]) System.out.println System.out System System.out a[i] a i for (int i = 1; i < n; i++) {
            int v = a[i];
            int j = i - 1;
            for (; j >= 0 && a[j] > v; j--) {
                a[j + 1] = a[j];
            }
            a[j + 1] = v;
            // 表示
            for (int k = 0; k < a.length; k++) {
                if (k < a.length - 1) {
                    System.out.print(a[k] + " ");
                } else {
                    System.out.println(a[k]);
                }
            }
        } int i = 1; int i = 1; i 1 i < n i n i++ i++ i {
            int v = a[i];
            int j = i - 1;
            for (; j >= 0 && a[j] > v; j--) {
                a[j + 1] = a[j];
            }
            a[j + 1] = v;
            // 表示
            for (int k = 0; k < a.length; k++) {
                if (k < a.length - 1) {
                    System.out.print(a[k] + " ");
                } else {
                    System.out.println(a[k]);
                }
            }
        } {
            int v = a[i];
            int j = i - 1;
            for (; j >= 0 && a[j] > v; j--) {
                a[j + 1] = a[j];
            }
            a[j + 1] = v;
            // 表示
            for (int k = 0; k < a.length; k++) {
                if (k < a.length - 1) {
                    System.out.print(a[k] + " ");
                } else {
                    System.out.println(a[k]);
                }
            }
        } int v = a[i]; v a[i] a i int j = i - 1; j i - 1 i 1 for (; j >= 0 && a[j] > v; j--) {
                a[j + 1] = a[j];
            } ; j >= 0 && a[j] > v j >= 0 j 0 a[j] > v a[j] a j v j-- j-- j {
                a[j + 1] = a[j];
            } {
                a[j + 1] = a[j];
            } a[j + 1] = a[j] a[j + 1] a j + 1 j 1 a[j] a j a[j + 1] = v a[j + 1] a j + 1 j 1 v for (int k = 0; k < a.length; k++) {
                if (k < a.length - 1) {
                    System.out.print(a[k] + " ");
                } else {
                    System.out.println(a[k]);
                }
            } int k = 0; int k = 0; k 0 k < a.length k a.length a a.length k++ k++ k {
                if (k < a.length - 1) {
                    System.out.print(a[k] + " ");
                } else {
                    System.out.println(a[k]);
                }
            } {
                if (k < a.length - 1) {
                    System.out.print(a[k] + " ");
                } else {
                    System.out.println(a[k]);
                }
            } if (k < a.length - 1) {
                    System.out.print(a[k] + " ");
                } else {
                    System.out.println(a[k]);
                } k < a.length - 1 k a.length - 1 a.length a a.length 1 {
                    System.out.print(a[k] + " ");
                } System.out.print(a[k] + " ") System.out.print System.out System System.out a[k] + " " a[k] a k " " {
                    System.out.println(a[k]);
                } System.out.println(a[k]) System.out.println System.out System System.out a[k] a k String[] args args public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
        }
        // 初期状態（ソート前）の要素を表示
        for (int i = 0; i < a.length; i++) {
            if (i < a.length - 1) {
                System.out.print(a[i] + " ");
            } else {
                System.out.println(a[i]);
            }
        }
        // 挿入ソート
        for (int i = 1; i < n; i++) {
            int v = a[i];
            int j = i - 1;
            for (; j >= 0 && a[j] > v; j--) {
                a[j + 1] = a[j];
            }
            a[j + 1] = v;
            // 表示
            for (int k = 0; k < a.length; k++) {
                if (k < a.length - 1) {
                    System.out.print(a[k] + " ");
                } else {
                    System.out.println(a[k]);
                }
            }
        }

    }

} public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
        }
        // 初期状態（ソート前）の要素を表示
        for (int i = 0; i < a.length; i++) {
            if (i < a.length - 1) {
                System.out.print(a[i] + " ");
            } else {
                System.out.println(a[i]);
            }
        }
        // 挿入ソート
        for (int i = 1; i < n; i++) {
            int v = a[i];
            int j = i - 1;
            for (; j >= 0 && a[j] > v; j--) {
                a[j + 1] = a[j];
            }
            a[j + 1] = v;
            // 表示
            for (int k = 0; k < a.length; k++) {
                if (k < a.length - 1) {
                    System.out.print(a[k] + " ");
                } else {
                    System.out.println(a[k]);
                }
            }
        }

    }

} Main
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
        }
        // 初期状態（ソート前）の要素を表示
        for (int i = 0; i < a.length; i++) {
            if (i < a.length - 1) {
                System.out.print(a[i] + " ");
            } else {
                System.out.println(a[i]);
            }
        }
        // 挿入ソート
        for (int i = 1; i < n; i++) {
            int v = a[i];
            int j = i - 1;
            for (; j >= 0 && a[j] > v; j--) {
                a[j + 1] = a[j];
            }
            a[j + 1] = v;
            // 表示
            for (int k = 0; k < a.length; k++) {
                if (k < a.length - 1) {
                    System.out.print(a[k] + " ");
                } else {
                    System.out.println(a[k]);
                }
            }
        }

    }

}
