import java.util.Arrays;
import java.util.Scanner;
public class Main {
    public static void main(String[] args){
        Scanner input = new Scanner(System.in);
// Get numbers
        int n = input.nextInt();
        int[] nums = new int[n];

// fill array
        for(int i = 0; i < n; i++){
            nums[i] = input.nextInt();
        }

        insertSort(n, nums);
    }

    public static void insertSort(int n, int[] nums){
        for(int i = 1; i<= nums.length-1; i++){
            printHelp(nums);
            int key = nums[i];
            // insert A[i] into the sorted sequence A[0,...,j-1]
            int j = i - 1;
            while(j >= 0 && nums[j] > key){
                nums[j+1] = nums[j];
                j--;
            }
            nums[j+1] = key;
        }
        printHelp(nums);
    }

    private static void printHelp(int[] nums){
        for(int i = 0; i < nums.length - 1; i++){
            System.out.print(nums[i] + " ");
        }
        System.out.print(nums[nums.length-1] + "\n");
    }
} import java.util.Arrays; Arrays java.util import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args){
        Scanner input = new Scanner(System.in);
// Get numbers
        int n = input.nextInt();
        int[] nums = new int[n];

// fill array
        for(int i = 0; i < n; i++){
            nums[i] = input.nextInt();
        }

        insertSort(n, nums);
    }

    public static void insertSort(int n, int[] nums){
        for(int i = 1; i<= nums.length-1; i++){
            printHelp(nums);
            int key = nums[i];
            // insert A[i] into the sorted sequence A[0,...,j-1]
            int j = i - 1;
            while(j >= 0 && nums[j] > key){
                nums[j+1] = nums[j];
                j--;
            }
            nums[j+1] = key;
        }
        printHelp(nums);
    }

    private static void printHelp(int[] nums){
        for(int i = 0; i < nums.length - 1; i++){
            System.out.print(nums[i] + " ");
        }
        System.out.print(nums[nums.length-1] + "\n");
    }
} Main public static void main(String[] args){
        Scanner input = new Scanner(System.in);
// Get numbers
        int n = input.nextInt();
        int[] nums = new int[n];

// fill array
        for(int i = 0; i < n; i++){
            nums[i] = input.nextInt();
        }

        insertSort(n, nums);
    } main {
        Scanner input = new Scanner(System.in);
// Get numbers
        int n = input.nextInt();
        int[] nums = new int[n];

// fill array
        for(int i = 0; i < n; i++){
            nums[i] = input.nextInt();
        }

        insertSort(n, nums);
    } Scanner input = new Scanner(System.in); input new Scanner(System.in) int n = input.nextInt(); n input.nextInt() input.nextInt input int[] nums = new int[n]; nums new int[n] n for(int i = 0; i < n; i++){
            nums[i] = input.nextInt();
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            nums[i] = input.nextInt();
        } {
            nums[i] = input.nextInt();
        } nums[i] = input.nextInt() nums[i] nums i input.nextInt() input.nextInt input insertSort(n, nums) insertSort n nums String[] args args public static void insertSort(int n, int[] nums){
        for(int i = 1; i<= nums.length-1; i++){
            printHelp(nums);
            int key = nums[i];
            // insert A[i] into the sorted sequence A[0,...,j-1]
            int j = i - 1;
            while(j >= 0 && nums[j] > key){
                nums[j+1] = nums[j];
                j--;
            }
            nums[j+1] = key;
        }
        printHelp(nums);
    } insertSort {
        for(int i = 1; i<= nums.length-1; i++){
            printHelp(nums);
            int key = nums[i];
            // insert A[i] into the sorted sequence A[0,...,j-1]
            int j = i - 1;
            while(j >= 0 && nums[j] > key){
                nums[j+1] = nums[j];
                j--;
            }
            nums[j+1] = key;
        }
        printHelp(nums);
    } for(int i = 1; i<= nums.length-1; i++){
            printHelp(nums);
            int key = nums[i];
            // insert A[i] into the sorted sequence A[0,...,j-1]
            int j = i - 1;
            while(j >= 0 && nums[j] > key){
                nums[j+1] = nums[j];
                j--;
            }
            nums[j+1] = key;
        } int i = 1; int i = 1; i 1 i<= nums.length-1 i nums.length-1 nums.length nums nums.length 1 i++ i++ i {
            printHelp(nums);
            int key = nums[i];
            // insert A[i] into the sorted sequence A[0,...,j-1]
            int j = i - 1;
            while(j >= 0 && nums[j] > key){
                nums[j+1] = nums[j];
                j--;
            }
            nums[j+1] = key;
        } {
            printHelp(nums);
            int key = nums[i];
            // insert A[i] into the sorted sequence A[0,...,j-1]
            int j = i - 1;
            while(j >= 0 && nums[j] > key){
                nums[j+1] = nums[j];
                j--;
            }
            nums[j+1] = key;
        } printHelp(nums) printHelp nums 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 printHelp(nums) printHelp nums int n n int[] nums nums private static void printHelp(int[] nums){
        for(int i = 0; i < nums.length - 1; i++){
            System.out.print(nums[i] + " ");
        }
        System.out.print(nums[nums.length-1] + "\n");
    } printHelp {
        for(int i = 0; i < nums.length - 1; i++){
            System.out.print(nums[i] + " ");
        }
        System.out.print(nums[nums.length-1] + "\n");
    } for(int i = 0; i < nums.length - 1; i++){
            System.out.print(nums[i] + " ");
        } int i = 0; int i = 0; i 0 i < nums.length - 1 i nums.length - 1 nums.length nums nums.length 1 i++ i++ i {
            System.out.print(nums[i] + " ");
        } {
            System.out.print(nums[i] + " ");
        } System.out.print(nums[i] + " ") System.out.print System.out System System.out nums[i] + " " nums[i] nums i " " System.out.print(nums[nums.length-1] + "\n") System.out.print System.out System System.out nums[nums.length-1] + "\n" nums[nums.length-1] nums nums.length-1 nums.length nums nums.length 1 "\n" int[] nums nums public class Main {
    public static void main(String[] args){
        Scanner input = new Scanner(System.in);
// Get numbers
        int n = input.nextInt();
        int[] nums = new int[n];

// fill array
        for(int i = 0; i < n; i++){
            nums[i] = input.nextInt();
        }

        insertSort(n, nums);
    }

    public static void insertSort(int n, int[] nums){
        for(int i = 1; i<= nums.length-1; i++){
            printHelp(nums);
            int key = nums[i];
            // insert A[i] into the sorted sequence A[0,...,j-1]
            int j = i - 1;
            while(j >= 0 && nums[j] > key){
                nums[j+1] = nums[j];
                j--;
            }
            nums[j+1] = key;
        }
        printHelp(nums);
    }

    private static void printHelp(int[] nums){
        for(int i = 0; i < nums.length - 1; i++){
            System.out.print(nums[i] + " ");
        }
        System.out.print(nums[nums.length-1] + "\n");
    }
} public class Main {
    public static void main(String[] args){
        Scanner input = new Scanner(System.in);
// Get numbers
        int n = input.nextInt();
        int[] nums = new int[n];

// fill array
        for(int i = 0; i < n; i++){
            nums[i] = input.nextInt();
        }

        insertSort(n, nums);
    }

    public static void insertSort(int n, int[] nums){
        for(int i = 1; i<= nums.length-1; i++){
            printHelp(nums);
            int key = nums[i];
            // insert A[i] into the sorted sequence A[0,...,j-1]
            int j = i - 1;
            while(j >= 0 && nums[j] > key){
                nums[j+1] = nums[j];
                j--;
            }
            nums[j+1] = key;
        }
        printHelp(nums);
    }

    private static void printHelp(int[] nums){
        for(int i = 0; i < nums.length - 1; i++){
            System.out.print(nums[i] + " ");
        }
        System.out.print(nums[nums.length-1] + "\n");
    }
} Main
import java.util.Arrays;
import java.util.Scanner;
public class Main {
    public static void main(String[] args){
        Scanner input = new Scanner(System.in);
// Get numbers
        int n = input.nextInt();
        int[] nums = new int[n];

// fill array
        for(int i = 0; i < n; i++){
            nums[i] = input.nextInt();
        }

        insertSort(n, nums);
    }

    public static void insertSort(int n, int[] nums){
        for(int i = 1; i<= nums.length-1; i++){
            printHelp(nums);
            int key = nums[i];
            // insert A[i] into the sorted sequence A[0,...,j-1]
            int j = i - 1;
            while(j >= 0 && nums[j] > key){
                nums[j+1] = nums[j];
                j--;
            }
            nums[j+1] = key;
        }
        printHelp(nums);
    }

    private static void printHelp(int[] nums){
        for(int i = 0; i < nums.length - 1; i++){
            System.out.print(nums[i] + " ");
        }
        System.out.print(nums[nums.length-1] + "\n");
    }
}
