
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int n = input.nextInt();
        List<Integer> list = new ArrayList<>();
        for(int i=0;i<n;i++){
            int num = input.nextInt();
            list.add(num);
        }
        iSort(list,n);
    }

    private static void iSort(List<Integer> list, int n){
        int count=0;
        List<Integer> sbList = new ArrayList<>(list);
        for(int num : list){
            for(int i = count-1; i >= 0 && sbList.get(i)>num; i--){
                sbList.set(i+1,sbList.get(i));
                sbList.set(i,num);
            }
            count++;

            for(int i = 0; i < list.size(); i ++){
                if(i == n-1)System.out.println(sbList.get(i));
                else System.out.print(sbList.get(i) + " ");
            }
        }
    }

}
 import java.util.ArrayList; ArrayList java.util import java.util.List; List java.util import java.util.Scanner; Scanner java.util public class Main {

    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int n = input.nextInt();
        List<Integer> list = new ArrayList<>();
        for(int i=0;i<n;i++){
            int num = input.nextInt();
            list.add(num);
        }
        iSort(list,n);
    }

    private static void iSort(List<Integer> list, int n){
        int count=0;
        List<Integer> sbList = new ArrayList<>(list);
        for(int num : list){
            for(int i = count-1; i >= 0 && sbList.get(i)>num; i--){
                sbList.set(i+1,sbList.get(i));
                sbList.set(i,num);
            }
            count++;

            for(int i = 0; i < list.size(); i ++){
                if(i == n-1)System.out.println(sbList.get(i));
                else System.out.print(sbList.get(i) + " ");
            }
        }
    }

} Main public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int n = input.nextInt();
        List<Integer> list = new ArrayList<>();
        for(int i=0;i<n;i++){
            int num = input.nextInt();
            list.add(num);
        }
        iSort(list,n);
    } main {
        Scanner input = new Scanner(System.in);
        int n = input.nextInt();
        List<Integer> list = new ArrayList<>();
        for(int i=0;i<n;i++){
            int num = input.nextInt();
            list.add(num);
        }
        iSort(list,n);
    } Scanner input = new Scanner(System.in); input new Scanner(System.in) int n = input.nextInt(); n input.nextInt() input.nextInt input List<Integer> list = new ArrayList<>(); list new ArrayList<>() for(int i=0;i<n;i++){
            int num = input.nextInt();
            list.add(num);
        } int i=0; int i=0; i 0 i<n i n i++ i++ i {
            int num = input.nextInt();
            list.add(num);
        } {
            int num = input.nextInt();
            list.add(num);
        } int num = input.nextInt(); num input.nextInt() input.nextInt input list.add(num) list.add list num iSort(list,n) iSort list n String[] args args private static void iSort(List<Integer> list, int n){
        int count=0;
        List<Integer> sbList = new ArrayList<>(list);
        for(int num : list){
            for(int i = count-1; i >= 0 && sbList.get(i)>num; i--){
                sbList.set(i+1,sbList.get(i));
                sbList.set(i,num);
            }
            count++;

            for(int i = 0; i < list.size(); i ++){
                if(i == n-1)System.out.println(sbList.get(i));
                else System.out.print(sbList.get(i) + " ");
            }
        }
    } iSort {
        int count=0;
        List<Integer> sbList = new ArrayList<>(list);
        for(int num : list){
            for(int i = count-1; i >= 0 && sbList.get(i)>num; i--){
                sbList.set(i+1,sbList.get(i));
                sbList.set(i,num);
            }
            count++;

            for(int i = 0; i < list.size(); i ++){
                if(i == n-1)System.out.println(sbList.get(i));
                else System.out.print(sbList.get(i) + " ");
            }
        }
    } int count=0; count 0 List<Integer> sbList = new ArrayList<>(list); sbList new ArrayList<>(list) for(int num : list){
            for(int i = count-1; i >= 0 && sbList.get(i)>num; i--){
                sbList.set(i+1,sbList.get(i));
                sbList.set(i,num);
            }
            count++;

            for(int i = 0; i < list.size(); i ++){
                if(i == n-1)System.out.println(sbList.get(i));
                else System.out.print(sbList.get(i) + " ");
            }
        } int num list {
            for(int i = count-1; i >= 0 && sbList.get(i)>num; i--){
                sbList.set(i+1,sbList.get(i));
                sbList.set(i,num);
            }
            count++;

            for(int i = 0; i < list.size(); i ++){
                if(i == n-1)System.out.println(sbList.get(i));
                else System.out.print(sbList.get(i) + " ");
            }
        } {
            for(int i = count-1; i >= 0 && sbList.get(i)>num; i--){
                sbList.set(i+1,sbList.get(i));
                sbList.set(i,num);
            }
            count++;

            for(int i = 0; i < list.size(); i ++){
                if(i == n-1)System.out.println(sbList.get(i));
                else System.out.print(sbList.get(i) + " ");
            }
        } for(int i = count-1; i >= 0 && sbList.get(i)>num; i--){
                sbList.set(i+1,sbList.get(i));
                sbList.set(i,num);
            } int i = count-1; int i = count-1; i count-1 count 1 i >= 0 && sbList.get(i)>num i >= 0 i 0 sbList.get(i)>num sbList.get(i) sbList.get sbList i num i-- i-- i {
                sbList.set(i+1,sbList.get(i));
                sbList.set(i,num);
            } {
                sbList.set(i+1,sbList.get(i));
                sbList.set(i,num);
            } sbList.set(i+1,sbList.get(i)) sbList.set sbList i+1 i 1 sbList.get(i) sbList.get sbList i sbList.set(i,num) sbList.set sbList i num count++ count for(int i = 0; i < list.size(); i ++){
                if(i == n-1)System.out.println(sbList.get(i));
                else System.out.print(sbList.get(i) + " ");
            } int i = 0; int i = 0; i 0 i < list.size() i list.size() list.size list i ++ i ++ i {
                if(i == n-1)System.out.println(sbList.get(i));
                else System.out.print(sbList.get(i) + " ");
            } {
                if(i == n-1)System.out.println(sbList.get(i));
                else System.out.print(sbList.get(i) + " ");
            } if(i == n-1)System.out.println(sbList.get(i));
                else System.out.print(sbList.get(i) + " "); i == n-1 i n-1 n 1 System.out.println(sbList.get(i)) System.out.println System.out System System.out sbList.get(i) sbList.get sbList i System.out.print(sbList.get(i) + " ") System.out.print System.out System System.out sbList.get(i) + " " sbList.get(i) sbList.get sbList i " " List<Integer> list list int n n public class Main {

    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int n = input.nextInt();
        List<Integer> list = new ArrayList<>();
        for(int i=0;i<n;i++){
            int num = input.nextInt();
            list.add(num);
        }
        iSort(list,n);
    }

    private static void iSort(List<Integer> list, int n){
        int count=0;
        List<Integer> sbList = new ArrayList<>(list);
        for(int num : list){
            for(int i = count-1; i >= 0 && sbList.get(i)>num; i--){
                sbList.set(i+1,sbList.get(i));
                sbList.set(i,num);
            }
            count++;

            for(int i = 0; i < list.size(); i ++){
                if(i == n-1)System.out.println(sbList.get(i));
                else System.out.print(sbList.get(i) + " ");
            }
        }
    }

} public class Main {

    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int n = input.nextInt();
        List<Integer> list = new ArrayList<>();
        for(int i=0;i<n;i++){
            int num = input.nextInt();
            list.add(num);
        }
        iSort(list,n);
    }

    private static void iSort(List<Integer> list, int n){
        int count=0;
        List<Integer> sbList = new ArrayList<>(list);
        for(int num : list){
            for(int i = count-1; i >= 0 && sbList.get(i)>num; i--){
                sbList.set(i+1,sbList.get(i));
                sbList.set(i,num);
            }
            count++;

            for(int i = 0; i < list.size(); i ++){
                if(i == n-1)System.out.println(sbList.get(i));
                else System.out.print(sbList.get(i) + " ");
            }
        }
    }

} Main

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int n = input.nextInt();
        List<Integer> list = new ArrayList<>();
        for(int i=0;i<n;i++){
            int num = input.nextInt();
            list.add(num);
        }
        iSort(list,n);
    }

    private static void iSort(List<Integer> list, int n){
        int count=0;
        List<Integer> sbList = new ArrayList<>(list);
        for(int num : list){
            for(int i = count-1; i >= 0 && sbList.get(i)>num; i--){
                sbList.set(i+1,sbList.get(i));
                sbList.set(i,num);
            }
            count++;

            for(int i = 0; i < list.size(); i ++){
                if(i == n-1)System.out.println(sbList.get(i));
                else System.out.print(sbList.get(i) + " ");
            }
        }
    }

}

