import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        int[] a = new int[N];
        for (int i = 0; i < N; i++) {
            a[i] = scanner.nextInt();
        }
        print(a);
        insertionSort(a);
    }

    private static void insertionSort(int[] a) {
        for (int i = 1; i < a.length; i++) {
            int v = a[i];
            int j = i - 1;
            while (j >= 0 && a[j] > v) {
                a[j + 1] = a[j];
                j--;
            }
            a[j + 1] = v;
            print(a);
        }
    }

    private static void print(int[] a) {
        for (int i = 0; i < a.length; i++) {
            System.out.print(a[i]);
            if (i < a.length - 1) {
                System.out.print(" ");
            } else {
                System.out.println("");
            }
        }
    }
} import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        int[] a = new int[N];
        for (int i = 0; i < N; i++) {
            a[i] = scanner.nextInt();
        }
        print(a);
        insertionSort(a);
    }

    private static void insertionSort(int[] a) {
        for (int i = 1; i < a.length; i++) {
            int v = a[i];
            int j = i - 1;
            while (j >= 0 && a[j] > v) {
                a[j + 1] = a[j];
                j--;
            }
            a[j + 1] = v;
            print(a);
        }
    }

    private static void print(int[] a) {
        for (int i = 0; i < a.length; i++) {
            System.out.print(a[i]);
            if (i < a.length - 1) {
                System.out.print(" ");
            } else {
                System.out.println("");
            }
        }
    }
} Main public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        int[] a = new int[N];
        for (int i = 0; i < N; i++) {
            a[i] = scanner.nextInt();
        }
        print(a);
        insertionSort(a);
    } main {
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        int[] a = new int[N];
        for (int i = 0; i < N; i++) {
            a[i] = scanner.nextInt();
        }
        print(a);
        insertionSort(a);
    } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) int N = scanner.nextInt(); N scanner.nextInt() scanner.nextInt scanner int[] a = new int[N]; a new int[N] N for (int i = 0; i < N; i++) {
            a[i] = scanner.nextInt();
        } int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
            a[i] = scanner.nextInt();
        } {
            a[i] = scanner.nextInt();
        } a[i] = scanner.nextInt() a[i] a i scanner.nextInt() scanner.nextInt scanner print(a) print a insertionSort(a) insertionSort a String[] args args private static void insertionSort(int[] a) {
        for (int i = 1; i < a.length; i++) {
            int v = a[i];
            int j = i - 1;
            while (j >= 0 && a[j] > v) {
                a[j + 1] = a[j];
                j--;
            }
            a[j + 1] = v;
            print(a);
        }
    } insertionSort {
        for (int i = 1; i < a.length; i++) {
            int v = a[i];
            int j = i - 1;
            while (j >= 0 && a[j] > v) {
                a[j + 1] = a[j];
                j--;
            }
            a[j + 1] = v;
            print(a);
        }
    } for (int i = 1; i < a.length; i++) {
            int v = a[i];
            int j = i - 1;
            while (j >= 0 && a[j] > v) {
                a[j + 1] = a[j];
                j--;
            }
            a[j + 1] = v;
            print(a);
        } int i = 1; int i = 1; i 1 i < a.length i a.length a a.length i++ i++ i {
            int v = a[i];
            int j = i - 1;
            while (j >= 0 && a[j] > v) {
                a[j + 1] = a[j];
                j--;
            }
            a[j + 1] = v;
            print(a);
        } {
            int v = a[i];
            int j = i - 1;
            while (j >= 0 && a[j] > v) {
                a[j + 1] = a[j];
                j--;
            }
            a[j + 1] = v;
            print(a);
        } int v = a[i]; v a[i] a i int j = i - 1; j i - 1 i 1 while (j >= 0 && a[j] > v) {
                a[j + 1] = a[j];
                j--;
            } j >= 0 && a[j] > v j >= 0 j 0 a[j] > v a[j] a j v {
                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] = v a[j + 1] a j + 1 j 1 v print(a) print a int[] a a private static void print(int[] a) {
        for (int i = 0; i < a.length; i++) {
            System.out.print(a[i]);
            if (i < a.length - 1) {
                System.out.print(" ");
            } else {
                System.out.println("");
            }
        }
    } print {
        for (int i = 0; i < a.length; i++) {
            System.out.print(a[i]);
            if (i < a.length - 1) {
                System.out.print(" ");
            } else {
                System.out.println("");
            }
        }
    } for (int i = 0; i < a.length; i++) {
            System.out.print(a[i]);
            if (i < a.length - 1) {
                System.out.print(" ");
            } else {
                System.out.println("");
            }
        } int i = 0; int i = 0; i 0 i < a.length i a.length a a.length i++ i++ i {
            System.out.print(a[i]);
            if (i < a.length - 1) {
                System.out.print(" ");
            } else {
                System.out.println("");
            }
        } {
            System.out.print(a[i]);
            if (i < a.length - 1) {
                System.out.print(" ");
            } else {
                System.out.println("");
            }
        } System.out.print(a[i]) System.out.print System.out System System.out a[i] a i 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 "" int[] a a public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        int[] a = new int[N];
        for (int i = 0; i < N; i++) {
            a[i] = scanner.nextInt();
        }
        print(a);
        insertionSort(a);
    }

    private static void insertionSort(int[] a) {
        for (int i = 1; i < a.length; i++) {
            int v = a[i];
            int j = i - 1;
            while (j >= 0 && a[j] > v) {
                a[j + 1] = a[j];
                j--;
            }
            a[j + 1] = v;
            print(a);
        }
    }

    private static void print(int[] a) {
        for (int i = 0; i < a.length; i++) {
            System.out.print(a[i]);
            if (i < a.length - 1) {
                System.out.print(" ");
            } else {
                System.out.println("");
            }
        }
    }
} public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        int[] a = new int[N];
        for (int i = 0; i < N; i++) {
            a[i] = scanner.nextInt();
        }
        print(a);
        insertionSort(a);
    }

    private static void insertionSort(int[] a) {
        for (int i = 1; i < a.length; i++) {
            int v = a[i];
            int j = i - 1;
            while (j >= 0 && a[j] > v) {
                a[j + 1] = a[j];
                j--;
            }
            a[j + 1] = v;
            print(a);
        }
    }

    private static void print(int[] a) {
        for (int i = 0; i < a.length; i++) {
            System.out.print(a[i]);
            if (i < a.length - 1) {
                System.out.print(" ");
            } else {
                System.out.println("");
            }
        }
    }
} Main
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        int[] a = new int[N];
        for (int i = 0; i < N; i++) {
            a[i] = scanner.nextInt();
        }
        print(a);
        insertionSort(a);
    }

    private static void insertionSort(int[] a) {
        for (int i = 1; i < a.length; i++) {
            int v = a[i];
            int j = i - 1;
            while (j >= 0 && a[j] > v) {
                a[j + 1] = a[j];
                j--;
            }
            a[j + 1] = v;
            print(a);
        }
    }

    private static void print(int[] a) {
        for (int i = 0; i < a.length; i++) {
            System.out.print(a[i]);
            if (i < a.length - 1) {
                System.out.print(" ");
            } else {
                System.out.println("");
            }
        }
    }
}