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

/**
 * Created by shoya on 2017/04/11.
 */
public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        ArrayList<Integer> ar = new ArrayList<>();
        for (int i = 0; i < n; i++)
            ar.add(sc.nextInt());
        //System.out.println(ar);
        insertionSort(ar);
    }

    static ArrayList<Integer> insertionSort(ArrayList<Integer> ar){
        for (int i = 0; i < ar.size(); i++){
            for (int j = 0; j < i; j++){
                if (ar.get(j) > ar.get(i)){
                    for (int k = i; k > j; k--){
                        int tmp = ar.get(k - 1);
                        ar.set(k - 1, ar.get(k));
                        ar.set(k, tmp);
                    }
                }
            }
            for (int n = 0; n < ar.size() - 1; n++)
                System.out.printf("%d ", ar.get(n));
            System.out.println(ar.get(ar.size() - 1));
        }
        return ar;
    }

} import java.util.ArrayList; ArrayList java.util import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        ArrayList<Integer> ar = new ArrayList<>();
        for (int i = 0; i < n; i++)
            ar.add(sc.nextInt());
        //System.out.println(ar);
        insertionSort(ar);
    }

    static ArrayList<Integer> insertionSort(ArrayList<Integer> ar){
        for (int i = 0; i < ar.size(); i++){
            for (int j = 0; j < i; j++){
                if (ar.get(j) > ar.get(i)){
                    for (int k = i; k > j; k--){
                        int tmp = ar.get(k - 1);
                        ar.set(k - 1, ar.get(k));
                        ar.set(k, tmp);
                    }
                }
            }
            for (int n = 0; n < ar.size() - 1; n++)
                System.out.printf("%d ", ar.get(n));
            System.out.println(ar.get(ar.size() - 1));
        }
        return ar;
    }

} Main public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        ArrayList<Integer> ar = new ArrayList<>();
        for (int i = 0; i < n; i++)
            ar.add(sc.nextInt());
        //System.out.println(ar);
        insertionSort(ar);
    } main {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        ArrayList<Integer> ar = new ArrayList<>();
        for (int i = 0; i < n; i++)
            ar.add(sc.nextInt());
        //System.out.println(ar);
        insertionSort(ar);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc ArrayList<Integer> ar = new ArrayList<>(); ar new ArrayList<>() for (int i = 0; i < n; i++)
            ar.add(sc.nextInt()); int i = 0; int i = 0; i 0 i < n i n i++ i++ i ar.add(sc.nextInt()); ar.add(sc.nextInt()) ar.add ar sc.nextInt() sc.nextInt sc insertionSort(ar) insertionSort ar String[] args args static ArrayList<Integer> insertionSort(ArrayList<Integer> ar){
        for (int i = 0; i < ar.size(); i++){
            for (int j = 0; j < i; j++){
                if (ar.get(j) > ar.get(i)){
                    for (int k = i; k > j; k--){
                        int tmp = ar.get(k - 1);
                        ar.set(k - 1, ar.get(k));
                        ar.set(k, tmp);
                    }
                }
            }
            for (int n = 0; n < ar.size() - 1; n++)
                System.out.printf("%d ", ar.get(n));
            System.out.println(ar.get(ar.size() - 1));
        }
        return ar;
    } insertionSort {
        for (int i = 0; i < ar.size(); i++){
            for (int j = 0; j < i; j++){
                if (ar.get(j) > ar.get(i)){
                    for (int k = i; k > j; k--){
                        int tmp = ar.get(k - 1);
                        ar.set(k - 1, ar.get(k));
                        ar.set(k, tmp);
                    }
                }
            }
            for (int n = 0; n < ar.size() - 1; n++)
                System.out.printf("%d ", ar.get(n));
            System.out.println(ar.get(ar.size() - 1));
        }
        return ar;
    } for (int i = 0; i < ar.size(); i++){
            for (int j = 0; j < i; j++){
                if (ar.get(j) > ar.get(i)){
                    for (int k = i; k > j; k--){
                        int tmp = ar.get(k - 1);
                        ar.set(k - 1, ar.get(k));
                        ar.set(k, tmp);
                    }
                }
            }
            for (int n = 0; n < ar.size() - 1; n++)
                System.out.printf("%d ", ar.get(n));
            System.out.println(ar.get(ar.size() - 1));
        } int i = 0; int i = 0; i 0 i < ar.size() i ar.size() ar.size ar i++ i++ i {
            for (int j = 0; j < i; j++){
                if (ar.get(j) > ar.get(i)){
                    for (int k = i; k > j; k--){
                        int tmp = ar.get(k - 1);
                        ar.set(k - 1, ar.get(k));
                        ar.set(k, tmp);
                    }
                }
            }
            for (int n = 0; n < ar.size() - 1; n++)
                System.out.printf("%d ", ar.get(n));
            System.out.println(ar.get(ar.size() - 1));
        } {
            for (int j = 0; j < i; j++){
                if (ar.get(j) > ar.get(i)){
                    for (int k = i; k > j; k--){
                        int tmp = ar.get(k - 1);
                        ar.set(k - 1, ar.get(k));
                        ar.set(k, tmp);
                    }
                }
            }
            for (int n = 0; n < ar.size() - 1; n++)
                System.out.printf("%d ", ar.get(n));
            System.out.println(ar.get(ar.size() - 1));
        } for (int j = 0; j < i; j++){
                if (ar.get(j) > ar.get(i)){
                    for (int k = i; k > j; k--){
                        int tmp = ar.get(k - 1);
                        ar.set(k - 1, ar.get(k));
                        ar.set(k, tmp);
                    }
                }
            } int j = 0; int j = 0; j 0 j < i j i j++ j++ j {
                if (ar.get(j) > ar.get(i)){
                    for (int k = i; k > j; k--){
                        int tmp = ar.get(k - 1);
                        ar.set(k - 1, ar.get(k));
                        ar.set(k, tmp);
                    }
                }
            } {
                if (ar.get(j) > ar.get(i)){
                    for (int k = i; k > j; k--){
                        int tmp = ar.get(k - 1);
                        ar.set(k - 1, ar.get(k));
                        ar.set(k, tmp);
                    }
                }
            } if (ar.get(j) > ar.get(i)){
                    for (int k = i; k > j; k--){
                        int tmp = ar.get(k - 1);
                        ar.set(k - 1, ar.get(k));
                        ar.set(k, tmp);
                    }
                } ar.get(j) > ar.get(i) ar.get(j) ar.get ar j ar.get(i) ar.get ar i {
                    for (int k = i; k > j; k--){
                        int tmp = ar.get(k - 1);
                        ar.set(k - 1, ar.get(k));
                        ar.set(k, tmp);
                    }
                } for (int k = i; k > j; k--){
                        int tmp = ar.get(k - 1);
                        ar.set(k - 1, ar.get(k));
                        ar.set(k, tmp);
                    } int k = i; int k = i; k i k > j k j k-- k-- k {
                        int tmp = ar.get(k - 1);
                        ar.set(k - 1, ar.get(k));
                        ar.set(k, tmp);
                    } {
                        int tmp = ar.get(k - 1);
                        ar.set(k - 1, ar.get(k));
                        ar.set(k, tmp);
                    } int tmp = ar.get(k - 1); tmp ar.get(k - 1) ar.get ar k - 1 k 1 ar.set(k - 1, ar.get(k)) ar.set ar k - 1 k 1 ar.get(k) ar.get ar k ar.set(k, tmp) ar.set ar k tmp for (int n = 0; n < ar.size() - 1; n++)
                System.out.printf("%d ", ar.get(n)); int n = 0; int n = 0; n 0 n < ar.size() - 1 n ar.size() - 1 ar.size() ar.size ar 1 n++ n++ n System.out.printf("%d ", ar.get(n)); System.out.printf("%d ", ar.get(n)) System.out.printf System.out System System.out "%d " ar.get(n) ar.get ar n System.out.println(ar.get(ar.size() - 1)) System.out.println System.out System System.out ar.get(ar.size() - 1) ar.get ar ar.size() - 1 ar.size() ar.size ar 1 return ar; ar ArrayList<Integer> ar ar public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        ArrayList<Integer> ar = new ArrayList<>();
        for (int i = 0; i < n; i++)
            ar.add(sc.nextInt());
        //System.out.println(ar);
        insertionSort(ar);
    }

    static ArrayList<Integer> insertionSort(ArrayList<Integer> ar){
        for (int i = 0; i < ar.size(); i++){
            for (int j = 0; j < i; j++){
                if (ar.get(j) > ar.get(i)){
                    for (int k = i; k > j; k--){
                        int tmp = ar.get(k - 1);
                        ar.set(k - 1, ar.get(k));
                        ar.set(k, tmp);
                    }
                }
            }
            for (int n = 0; n < ar.size() - 1; n++)
                System.out.printf("%d ", ar.get(n));
            System.out.println(ar.get(ar.size() - 1));
        }
        return ar;
    }

} public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        ArrayList<Integer> ar = new ArrayList<>();
        for (int i = 0; i < n; i++)
            ar.add(sc.nextInt());
        //System.out.println(ar);
        insertionSort(ar);
    }

    static ArrayList<Integer> insertionSort(ArrayList<Integer> ar){
        for (int i = 0; i < ar.size(); i++){
            for (int j = 0; j < i; j++){
                if (ar.get(j) > ar.get(i)){
                    for (int k = i; k > j; k--){
                        int tmp = ar.get(k - 1);
                        ar.set(k - 1, ar.get(k));
                        ar.set(k, tmp);
                    }
                }
            }
            for (int n = 0; n < ar.size() - 1; n++)
                System.out.printf("%d ", ar.get(n));
            System.out.println(ar.get(ar.size() - 1));
        }
        return ar;
    }

} Main
import java.util.ArrayList;
import java.util.Scanner;
//import java.util.List;

/**
 * Created by shoya on 2017/04/11.
 */
public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        ArrayList<Integer> ar = new ArrayList<>();
        for (int i = 0; i < n; i++)
            ar.add(sc.nextInt());
        //System.out.println(ar);
        insertionSort(ar);
    }

    static ArrayList<Integer> insertionSort(ArrayList<Integer> ar){
        for (int i = 0; i < ar.size(); i++){
            for (int j = 0; j < i; j++){
                if (ar.get(j) > ar.get(i)){
                    for (int k = i; k > j; k--){
                        int tmp = ar.get(k - 1);
                        ar.set(k - 1, ar.get(k));
                        ar.set(k, tmp);
                    }
                }
            }
            for (int n = 0; n < ar.size() - 1; n++)
                System.out.printf("%d ", ar.get(n));
            System.out.println(ar.get(ar.size() - 1));
        }
        return ar;
    }

}