import 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());
        String[] line = br.readLine().split(" ");
        int[] nums = new int[n];

        for(int i = 0; i < n; i++){
            nums[i] = Integer.parseInt(line[i]);
        }
        for(int i = 0; i < n; i++){
            System.out.print(nums[i]);
            if(i != n-1){
                System.out.print(" ");
            }
        }
        System.out.print("\n");

        for(int i = 1; i < n; i++){

            int key = nums[i];
            int j = i - 1;

            while(j >= 0 && nums[j] > key){
                nums[j+1] = nums[j];
                j--;
            }
            nums[j+1] = key;
            for(int x = 0; x < n; x++){
                System.out.print(nums[x]);
                if(x != n-1){
                    System.out.print(" ");
                }
            }
            System.out.print("\n");
        }
    }
} import java.io.*; io.* java 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());
        String[] line = br.readLine().split(" ");
        int[] nums = new int[n];

        for(int i = 0; i < n; i++){
            nums[i] = Integer.parseInt(line[i]);
        }
        for(int i = 0; i < n; i++){
            System.out.print(nums[i]);
            if(i != n-1){
                System.out.print(" ");
            }
        }
        System.out.print("\n");

        for(int i = 1; i < n; i++){

            int key = nums[i];
            int j = i - 1;

            while(j >= 0 && nums[j] > key){
                nums[j+1] = nums[j];
                j--;
            }
            nums[j+1] = key;
            for(int x = 0; x < n; x++){
                System.out.print(nums[x]);
                if(x != n-1){
                    System.out.print(" ");
                }
            }
            System.out.print("\n");
        }
    }
} Main public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        String[] line = br.readLine().split(" ");
        int[] nums = new int[n];

        for(int i = 0; i < n; i++){
            nums[i] = Integer.parseInt(line[i]);
        }
        for(int i = 0; i < n; i++){
            System.out.print(nums[i]);
            if(i != n-1){
                System.out.print(" ");
            }
        }
        System.out.print("\n");

        for(int i = 1; i < n; i++){

            int key = nums[i];
            int j = i - 1;

            while(j >= 0 && nums[j] > key){
                nums[j+1] = nums[j];
                j--;
            }
            nums[j+1] = key;
            for(int x = 0; x < n; x++){
                System.out.print(nums[x]);
                if(x != n-1){
                    System.out.print(" ");
                }
            }
            System.out.print("\n");
        }
    } main {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        String[] line = br.readLine().split(" ");
        int[] nums = new int[n];

        for(int i = 0; i < n; i++){
            nums[i] = Integer.parseInt(line[i]);
        }
        for(int i = 0; i < n; i++){
            System.out.print(nums[i]);
            if(i != n-1){
                System.out.print(" ");
            }
        }
        System.out.print("\n");

        for(int i = 1; i < n; i++){

            int key = nums[i];
            int j = i - 1;

            while(j >= 0 && nums[j] > key){
                nums[j+1] = nums[j];
                j--;
            }
            nums[j+1] = key;
            for(int x = 0; x < n; x++){
                System.out.print(nums[x]);
                if(x != n-1){
                    System.out.print(" ");
                }
            }
            System.out.print("\n");
        }
    } 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 String[] line = br.readLine().split(" "); line br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " int[] nums = new int[n]; nums new int[n] n for(int i = 0; i < n; i++){
            nums[i] = Integer.parseInt(line[i]);
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            nums[i] = Integer.parseInt(line[i]);
        } {
            nums[i] = Integer.parseInt(line[i]);
        } nums[i] = Integer.parseInt(line[i]) nums[i] nums i Integer.parseInt(line[i]) Integer.parseInt Integer line[i] line i for(int i = 0; i < n; i++){
            System.out.print(nums[i]);
            if(i != n-1){
                System.out.print(" ");
            }
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            System.out.print(nums[i]);
            if(i != n-1){
                System.out.print(" ");
            }
        } {
            System.out.print(nums[i]);
            if(i != n-1){
                System.out.print(" ");
            }
        } System.out.print(nums[i]) System.out.print System.out System System.out nums[i] nums i if(i != n-1){
                System.out.print(" ");
            } i != n-1 i n-1 n 1 {
                System.out.print(" ");
            } System.out.print(" ") System.out.print System.out System System.out " " System.out.print("\n") System.out.print System.out System System.out "\n" for(int i = 1; i < n; i++){

            int key = nums[i];
            int j = i - 1;

            while(j >= 0 && nums[j] > key){
                nums[j+1] = nums[j];
                j--;
            }
            nums[j+1] = key;
            for(int x = 0; x < n; x++){
                System.out.print(nums[x]);
                if(x != n-1){
                    System.out.print(" ");
                }
            }
            System.out.print("\n");
        } int i = 1; int i = 1; i 1 i < n i n i++ i++ i {

            int key = nums[i];
            int j = i - 1;

            while(j >= 0 && nums[j] > key){
                nums[j+1] = nums[j];
                j--;
            }
            nums[j+1] = key;
            for(int x = 0; x < n; x++){
                System.out.print(nums[x]);
                if(x != n-1){
                    System.out.print(" ");
                }
            }
            System.out.print("\n");
        } {

            int key = nums[i];
            int j = i - 1;

            while(j >= 0 && nums[j] > key){
                nums[j+1] = nums[j];
                j--;
            }
            nums[j+1] = key;
            for(int x = 0; x < n; x++){
                System.out.print(nums[x]);
                if(x != n-1){
                    System.out.print(" ");
                }
            }
            System.out.print("\n");
        } int key = nums[i]; key nums[i] nums i int j = i - 1; j i - 1 i 1 while(j >= 0 && nums[j] > key){
                nums[j+1] = nums[j];
                j--;
            } j >= 0 && nums[j] > key j >= 0 j 0 nums[j] > key nums[j] nums j key {
                nums[j+1] = nums[j];
                j--;
            } nums[j+1] = nums[j] nums[j+1] nums j+1 j 1 nums[j] nums j j-- j nums[j+1] = key nums[j+1] nums j+1 j 1 key for(int x = 0; x < n; x++){
                System.out.print(nums[x]);
                if(x != n-1){
                    System.out.print(" ");
                }
            } int x = 0; int x = 0; x 0 x < n x n x++ x++ x {
                System.out.print(nums[x]);
                if(x != n-1){
                    System.out.print(" ");
                }
            } {
                System.out.print(nums[x]);
                if(x != n-1){
                    System.out.print(" ");
                }
            } System.out.print(nums[x]) System.out.print System.out System System.out nums[x] nums x if(x != n-1){
                    System.out.print(" ");
                } x != n-1 x n-1 n 1 {
                    System.out.print(" ");
                } System.out.print(" ") System.out.print System.out System System.out " " System.out.print("\n") System.out.print System.out System System.out "\n" String[] args args 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());
        String[] line = br.readLine().split(" ");
        int[] nums = new int[n];

        for(int i = 0; i < n; i++){
            nums[i] = Integer.parseInt(line[i]);
        }
        for(int i = 0; i < n; i++){
            System.out.print(nums[i]);
            if(i != n-1){
                System.out.print(" ");
            }
        }
        System.out.print("\n");

        for(int i = 1; i < n; i++){

            int key = nums[i];
            int j = i - 1;

            while(j >= 0 && nums[j] > key){
                nums[j+1] = nums[j];
                j--;
            }
            nums[j+1] = key;
            for(int x = 0; x < n; x++){
                System.out.print(nums[x]);
                if(x != n-1){
                    System.out.print(" ");
                }
            }
            System.out.print("\n");
        }
    }
} 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());
        String[] line = br.readLine().split(" ");
        int[] nums = new int[n];

        for(int i = 0; i < n; i++){
            nums[i] = Integer.parseInt(line[i]);
        }
        for(int i = 0; i < n; i++){
            System.out.print(nums[i]);
            if(i != n-1){
                System.out.print(" ");
            }
        }
        System.out.print("\n");

        for(int i = 1; i < n; i++){

            int key = nums[i];
            int j = i - 1;

            while(j >= 0 && nums[j] > key){
                nums[j+1] = nums[j];
                j--;
            }
            nums[j+1] = key;
            for(int x = 0; x < n; x++){
                System.out.print(nums[x]);
                if(x != n-1){
                    System.out.print(" ");
                }
            }
            System.out.print("\n");
        }
    }
} Main
import 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());
        String[] line = br.readLine().split(" ");
        int[] nums = new int[n];

        for(int i = 0; i < n; i++){
            nums[i] = Integer.parseInt(line[i]);
        }
        for(int i = 0; i < n; i++){
            System.out.print(nums[i]);
            if(i != n-1){
                System.out.print(" ");
            }
        }
        System.out.print("\n");

        for(int i = 1; i < n; i++){

            int key = nums[i];
            int j = i - 1;

            while(j >= 0 && nums[j] > key){
                nums[j+1] = nums[j];
                j--;
            }
            nums[j+1] = key;
            for(int x = 0; x < n; x++){
                System.out.print(nums[x]);
                if(x != n-1){
                    System.out.print(" ");
                }
            }
            System.out.print("\n");
        }
    }
}