import java.util.*;

public class Main {
    public static void main(String[] args) {
        int total;

        Scanner inp = new Scanner(System.in);
        total = inp.nextInt();

        int[] a = new int[total];

        for (int k = 0; k < total; k++) {
            a[k] = inp.nextInt();
        }

        for (int l = 0; l < total; l++) {
            if (l == 0) {
                System.out.printf("%d", a[l]);
            } else {
                System.out.printf(" %d", a[l]);
            }
        }

        System.out.printf("\n");

        for (int i = 1; i <= a.length-1; i++) {
            int key = a[i];
            /* insert A[i] into the sorted sequence A[0,...,j-1] */
            int j = i - 1;
            while (j >= 0 && a[j] > key) {
                a[j+1] = a[j];
                j--;
            }
            a[j+1] = key;

            for (int l = 0; l < total; l++) {
                if (l == 0) {
                    System.out.printf("%d", a[l]);
                } else {
                    System.out.printf(" %d", a[l]);
                }
            }

            System.out.printf("\n");
        }
    }
}
 import java.util.*; util.* java public class Main {
    public static void main(String[] args) {
        int total;

        Scanner inp = new Scanner(System.in);
        total = inp.nextInt();

        int[] a = new int[total];

        for (int k = 0; k < total; k++) {
            a[k] = inp.nextInt();
        }

        for (int l = 0; l < total; l++) {
            if (l == 0) {
                System.out.printf("%d", a[l]);
            } else {
                System.out.printf(" %d", a[l]);
            }
        }

        System.out.printf("\n");

        for (int i = 1; i <= a.length-1; i++) {
            int key = a[i];
            /* insert A[i] into the sorted sequence A[0,...,j-1] */
            int j = i - 1;
            while (j >= 0 && a[j] > key) {
                a[j+1] = a[j];
                j--;
            }
            a[j+1] = key;

            for (int l = 0; l < total; l++) {
                if (l == 0) {
                    System.out.printf("%d", a[l]);
                } else {
                    System.out.printf(" %d", a[l]);
                }
            }

            System.out.printf("\n");
        }
    }
} Main public static void main(String[] args) {
        int total;

        Scanner inp = new Scanner(System.in);
        total = inp.nextInt();

        int[] a = new int[total];

        for (int k = 0; k < total; k++) {
            a[k] = inp.nextInt();
        }

        for (int l = 0; l < total; l++) {
            if (l == 0) {
                System.out.printf("%d", a[l]);
            } else {
                System.out.printf(" %d", a[l]);
            }
        }

        System.out.printf("\n");

        for (int i = 1; i <= a.length-1; i++) {
            int key = a[i];
            /* insert A[i] into the sorted sequence A[0,...,j-1] */
            int j = i - 1;
            while (j >= 0 && a[j] > key) {
                a[j+1] = a[j];
                j--;
            }
            a[j+1] = key;

            for (int l = 0; l < total; l++) {
                if (l == 0) {
                    System.out.printf("%d", a[l]);
                } else {
                    System.out.printf(" %d", a[l]);
                }
            }

            System.out.printf("\n");
        }
    } main {
        int total;

        Scanner inp = new Scanner(System.in);
        total = inp.nextInt();

        int[] a = new int[total];

        for (int k = 0; k < total; k++) {
            a[k] = inp.nextInt();
        }

        for (int l = 0; l < total; l++) {
            if (l == 0) {
                System.out.printf("%d", a[l]);
            } else {
                System.out.printf(" %d", a[l]);
            }
        }

        System.out.printf("\n");

        for (int i = 1; i <= a.length-1; i++) {
            int key = a[i];
            /* insert A[i] into the sorted sequence A[0,...,j-1] */
            int j = i - 1;
            while (j >= 0 && a[j] > key) {
                a[j+1] = a[j];
                j--;
            }
            a[j+1] = key;

            for (int l = 0; l < total; l++) {
                if (l == 0) {
                    System.out.printf("%d", a[l]);
                } else {
                    System.out.printf(" %d", a[l]);
                }
            }

            System.out.printf("\n");
        }
    } int total; total Scanner inp = new Scanner(System.in); inp new Scanner(System.in) total = inp.nextInt() total inp.nextInt() inp.nextInt inp int[] a = new int[total]; a new int[total] total for (int k = 0; k < total; k++) {
            a[k] = inp.nextInt();
        } int k = 0; int k = 0; k 0 k < total k total k++ k++ k {
            a[k] = inp.nextInt();
        } {
            a[k] = inp.nextInt();
        } a[k] = inp.nextInt() a[k] a k inp.nextInt() inp.nextInt inp for (int l = 0; l < total; l++) {
            if (l == 0) {
                System.out.printf("%d", a[l]);
            } else {
                System.out.printf(" %d", a[l]);
            }
        } int l = 0; int l = 0; l 0 l < total l total l++ l++ l {
            if (l == 0) {
                System.out.printf("%d", a[l]);
            } else {
                System.out.printf(" %d", a[l]);
            }
        } {
            if (l == 0) {
                System.out.printf("%d", a[l]);
            } else {
                System.out.printf(" %d", a[l]);
            }
        } if (l == 0) {
                System.out.printf("%d", a[l]);
            } else {
                System.out.printf(" %d", a[l]);
            } l == 0 l 0 {
                System.out.printf("%d", a[l]);
            } System.out.printf("%d", a[l]) System.out.printf System.out System System.out "%d" a[l] a l {
                System.out.printf(" %d", a[l]);
            } System.out.printf(" %d", a[l]) System.out.printf System.out System System.out " %d" a[l] a l System.out.printf("\n") System.out.printf System.out System System.out "\n" for (int i = 1; i <= a.length-1; i++) {
            int key = a[i];
            /* insert A[i] into the sorted sequence A[0,...,j-1] */
            int j = i - 1;
            while (j >= 0 && a[j] > key) {
                a[j+1] = a[j];
                j--;
            }
            a[j+1] = key;

            for (int l = 0; l < total; l++) {
                if (l == 0) {
                    System.out.printf("%d", a[l]);
                } else {
                    System.out.printf(" %d", a[l]);
                }
            }

            System.out.printf("\n");
        } int i = 1; int i = 1; i 1 i <= a.length-1 i a.length-1 a.length a a.length 1 i++ i++ i {
            int key = a[i];
            /* insert A[i] into the sorted sequence A[0,...,j-1] */
            int j = i - 1;
            while (j >= 0 && a[j] > key) {
                a[j+1] = a[j];
                j--;
            }
            a[j+1] = key;

            for (int l = 0; l < total; l++) {
                if (l == 0) {
                    System.out.printf("%d", a[l]);
                } else {
                    System.out.printf(" %d", a[l]);
                }
            }

            System.out.printf("\n");
        } {
            int key = a[i];
            /* insert A[i] into the sorted sequence A[0,...,j-1] */
            int j = i - 1;
            while (j >= 0 && a[j] > key) {
                a[j+1] = a[j];
                j--;
            }
            a[j+1] = key;

            for (int l = 0; l < total; l++) {
                if (l == 0) {
                    System.out.printf("%d", a[l]);
                } else {
                    System.out.printf(" %d", a[l]);
                }
            }

            System.out.printf("\n");
        } 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 for (int l = 0; l < total; l++) {
                if (l == 0) {
                    System.out.printf("%d", a[l]);
                } else {
                    System.out.printf(" %d", a[l]);
                }
            } int l = 0; int l = 0; l 0 l < total l total l++ l++ l {
                if (l == 0) {
                    System.out.printf("%d", a[l]);
                } else {
                    System.out.printf(" %d", a[l]);
                }
            } {
                if (l == 0) {
                    System.out.printf("%d", a[l]);
                } else {
                    System.out.printf(" %d", a[l]);
                }
            } if (l == 0) {
                    System.out.printf("%d", a[l]);
                } else {
                    System.out.printf(" %d", a[l]);
                } l == 0 l 0 {
                    System.out.printf("%d", a[l]);
                } System.out.printf("%d", a[l]) System.out.printf System.out System System.out "%d" a[l] a l {
                    System.out.printf(" %d", a[l]);
                } System.out.printf(" %d", a[l]) System.out.printf System.out System System.out " %d" a[l] a l System.out.printf("\n") System.out.printf System.out System System.out "\n" String[] args args public class Main {
    public static void main(String[] args) {
        int total;

        Scanner inp = new Scanner(System.in);
        total = inp.nextInt();

        int[] a = new int[total];

        for (int k = 0; k < total; k++) {
            a[k] = inp.nextInt();
        }

        for (int l = 0; l < total; l++) {
            if (l == 0) {
                System.out.printf("%d", a[l]);
            } else {
                System.out.printf(" %d", a[l]);
            }
        }

        System.out.printf("\n");

        for (int i = 1; i <= a.length-1; i++) {
            int key = a[i];
            /* insert A[i] into the sorted sequence A[0,...,j-1] */
            int j = i - 1;
            while (j >= 0 && a[j] > key) {
                a[j+1] = a[j];
                j--;
            }
            a[j+1] = key;

            for (int l = 0; l < total; l++) {
                if (l == 0) {
                    System.out.printf("%d", a[l]);
                } else {
                    System.out.printf(" %d", a[l]);
                }
            }

            System.out.printf("\n");
        }
    }
} public class Main {
    public static void main(String[] args) {
        int total;

        Scanner inp = new Scanner(System.in);
        total = inp.nextInt();

        int[] a = new int[total];

        for (int k = 0; k < total; k++) {
            a[k] = inp.nextInt();
        }

        for (int l = 0; l < total; l++) {
            if (l == 0) {
                System.out.printf("%d", a[l]);
            } else {
                System.out.printf(" %d", a[l]);
            }
        }

        System.out.printf("\n");

        for (int i = 1; i <= a.length-1; i++) {
            int key = a[i];
            /* insert A[i] into the sorted sequence A[0,...,j-1] */
            int j = i - 1;
            while (j >= 0 && a[j] > key) {
                a[j+1] = a[j];
                j--;
            }
            a[j+1] = key;

            for (int l = 0; l < total; l++) {
                if (l == 0) {
                    System.out.printf("%d", a[l]);
                } else {
                    System.out.printf(" %d", a[l]);
                }
            }

            System.out.printf("\n");
        }
    }
} Main
import java.util.*;

public class Main {
    public static void main(String[] args) {
        int total;

        Scanner inp = new Scanner(System.in);
        total = inp.nextInt();

        int[] a = new int[total];

        for (int k = 0; k < total; k++) {
            a[k] = inp.nextInt();
        }

        for (int l = 0; l < total; l++) {
            if (l == 0) {
                System.out.printf("%d", a[l]);
            } else {
                System.out.printf(" %d", a[l]);
            }
        }

        System.out.printf("\n");

        for (int i = 1; i <= a.length-1; i++) {
            int key = a[i];
            /* insert A[i] into the sorted sequence A[0,...,j-1] */
            int j = i - 1;
            while (j >= 0 && a[j] > key) {
                a[j+1] = a[j];
                j--;
            }
            a[j+1] = key;

            for (int l = 0; l < total; l++) {
                if (l == 0) {
                    System.out.printf("%d", a[l]);
                } else {
                    System.out.printf(" %d", a[l]);
                }
            }

            System.out.printf("\n");
        }
    }
}

