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

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        int[] list = new int[n];
        String[] lines = br.readLine().split(" ");
        int m = n;
        while (m-- > 0) {
            list[m] = Integer.parseInt(lines[m]);
        }
        print(list);
        insertionSort(list);

    }

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

    private static void print(int[] list) {
        for (int i = 0; i < list.length; i++) {
            System.out.print(list[i]);
            if (i < list.length - 1) {
                System.out.print(" ");
            }
        }
        System.out.println();
    }
} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        int[] list = new int[n];
        String[] lines = br.readLine().split(" ");
        int m = n;
        while (m-- > 0) {
            list[m] = Integer.parseInt(lines[m]);
        }
        print(list);
        insertionSort(list);

    }

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

    private static void print(int[] list) {
        for (int i = 0; i < list.length; i++) {
            System.out.print(list[i]);
            if (i < list.length - 1) {
                System.out.print(" ");
            }
        }
        System.out.println();
    }
} Main public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        int[] list = new int[n];
        String[] lines = br.readLine().split(" ");
        int m = n;
        while (m-- > 0) {
            list[m] = Integer.parseInt(lines[m]);
        }
        print(list);
        insertionSort(list);

    } main {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        int[] list = new int[n];
        String[] lines = br.readLine().split(" ");
        int m = n;
        while (m-- > 0) {
            list[m] = Integer.parseInt(lines[m]);
        }
        print(list);
        insertionSort(list);

    } 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 int[] list = new int[n]; list new int[n] n String[] lines = br.readLine().split(" "); lines br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " int m = n; m n while (m-- > 0) {
            list[m] = Integer.parseInt(lines[m]);
        } m-- > 0 m-- m 0 {
            list[m] = Integer.parseInt(lines[m]);
        } list[m] = Integer.parseInt(lines[m]) list[m] list m Integer.parseInt(lines[m]) Integer.parseInt Integer lines[m] lines m print(list) print list insertionSort(list) insertionSort list String[] args args static void insertionSort(int[] list) {
        for (int i = 1; i < list.length; i++) {
            int v = list[i];
            int j = i - 1;
            while (j >= 0 && list[j] > v) {
                list[j + 1] = list[j];
                j--;
            }
            list[j + 1] = v;
            print(list);
        }
    } insertionSort {
        for (int i = 1; i < list.length; i++) {
            int v = list[i];
            int j = i - 1;
            while (j >= 0 && list[j] > v) {
                list[j + 1] = list[j];
                j--;
            }
            list[j + 1] = v;
            print(list);
        }
    } for (int i = 1; i < list.length; i++) {
            int v = list[i];
            int j = i - 1;
            while (j >= 0 && list[j] > v) {
                list[j + 1] = list[j];
                j--;
            }
            list[j + 1] = v;
            print(list);
        } int i = 1; int i = 1; i 1 i < list.length i list.length list list.length i++ i++ i {
            int v = list[i];
            int j = i - 1;
            while (j >= 0 && list[j] > v) {
                list[j + 1] = list[j];
                j--;
            }
            list[j + 1] = v;
            print(list);
        } {
            int v = list[i];
            int j = i - 1;
            while (j >= 0 && list[j] > v) {
                list[j + 1] = list[j];
                j--;
            }
            list[j + 1] = v;
            print(list);
        } int v = list[i]; v list[i] list i int j = i - 1; j i - 1 i 1 while (j >= 0 && list[j] > v) {
                list[j + 1] = list[j];
                j--;
            } j >= 0 && list[j] > v j >= 0 j 0 list[j] > v list[j] list j v {
                list[j + 1] = list[j];
                j--;
            } list[j + 1] = list[j] list[j + 1] list j + 1 j 1 list[j] list j j-- j list[j + 1] = v list[j + 1] list j + 1 j 1 v print(list) print list int[] list list private static void print(int[] list) {
        for (int i = 0; i < list.length; i++) {
            System.out.print(list[i]);
            if (i < list.length - 1) {
                System.out.print(" ");
            }
        }
        System.out.println();
    } print {
        for (int i = 0; i < list.length; i++) {
            System.out.print(list[i]);
            if (i < list.length - 1) {
                System.out.print(" ");
            }
        }
        System.out.println();
    } for (int i = 0; i < list.length; i++) {
            System.out.print(list[i]);
            if (i < list.length - 1) {
                System.out.print(" ");
            }
        } int i = 0; int i = 0; i 0 i < list.length i list.length list list.length i++ i++ i {
            System.out.print(list[i]);
            if (i < list.length - 1) {
                System.out.print(" ");
            }
        } {
            System.out.print(list[i]);
            if (i < list.length - 1) {
                System.out.print(" ");
            }
        } System.out.print(list[i]) System.out.print System.out System System.out list[i] list i if (i < list.length - 1) {
                System.out.print(" ");
            } i < list.length - 1 i list.length - 1 list.length list list.length 1 {
                System.out.print(" ");
            } System.out.print(" ") System.out.print System.out System System.out " " System.out.println() System.out.println System.out System System.out int[] list list public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        int[] list = new int[n];
        String[] lines = br.readLine().split(" ");
        int m = n;
        while (m-- > 0) {
            list[m] = Integer.parseInt(lines[m]);
        }
        print(list);
        insertionSort(list);

    }

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

    private static void print(int[] list) {
        for (int i = 0; i < list.length; i++) {
            System.out.print(list[i]);
            if (i < list.length - 1) {
                System.out.print(" ");
            }
        }
        System.out.println();
    }
} public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        int[] list = new int[n];
        String[] lines = br.readLine().split(" ");
        int m = n;
        while (m-- > 0) {
            list[m] = Integer.parseInt(lines[m]);
        }
        print(list);
        insertionSort(list);

    }

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

    private static void print(int[] list) {
        for (int i = 0; i < list.length; i++) {
            System.out.print(list[i]);
            if (i < list.length - 1) {
                System.out.print(" ");
            }
        }
        System.out.println();
    }
} Main
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        int[] list = new int[n];
        String[] lines = br.readLine().split(" ");
        int m = n;
        while (m-- > 0) {
            list[m] = Integer.parseInt(lines[m]);
        }
        print(list);
        insertionSort(list);

    }

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

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