import java.io.IOException;
import java.util.Scanner;
import java.util.LinkedList;

public class Main {
    public static void main(String[] args) throws IOException {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        LinkedList<Integer> list = new LinkedList<Integer>();
        for (int i = 0; i < n; i++){
            list.add(sc.nextInt());
        }
        sc.close();
        InsertionSort(list);
    }
    
    static void InsertionSort(LinkedList<Integer> list){
        int key = 0;
        PrintList(list);
        for (int i = 1; i < list.size(); i++){
            key = list.get(i);
            int j = i - 1;
            while (j >= 0 && list.get(j) > key){
                swap(list, j+1, j);
                j--;
            }
            list.set(j+1 , key);
            PrintList(list);
        }
        
    }
    static void swap(LinkedList<Integer> list, int from, int to){
        int temp = list.get(from);
        list.set(from,list.get(to));
        list.set(to, temp);
     }
    static void PrintList(LinkedList<Integer> list){
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < list.size(); i++){
            sb.append(list.get(i)+" ");
        }
        System.out.println(sb.deleteCharAt(sb.length()-1));
        
    }
} import java.io.IOException; IOException java.io import java.util.Scanner; Scanner java.util import java.util.LinkedList; LinkedList java.util public class Main {
    public static void main(String[] args) throws IOException {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        LinkedList<Integer> list = new LinkedList<Integer>();
        for (int i = 0; i < n; i++){
            list.add(sc.nextInt());
        }
        sc.close();
        InsertionSort(list);
    }
    
    static void InsertionSort(LinkedList<Integer> list){
        int key = 0;
        PrintList(list);
        for (int i = 1; i < list.size(); i++){
            key = list.get(i);
            int j = i - 1;
            while (j >= 0 && list.get(j) > key){
                swap(list, j+1, j);
                j--;
            }
            list.set(j+1 , key);
            PrintList(list);
        }
        
    }
    static void swap(LinkedList<Integer> list, int from, int to){
        int temp = list.get(from);
        list.set(from,list.get(to));
        list.set(to, temp);
     }
    static void PrintList(LinkedList<Integer> list){
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < list.size(); i++){
            sb.append(list.get(i)+" ");
        }
        System.out.println(sb.deleteCharAt(sb.length()-1));
        
    }
} Main public static void main(String[] args) throws IOException {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        LinkedList<Integer> list = new LinkedList<Integer>();
        for (int i = 0; i < n; i++){
            list.add(sc.nextInt());
        }
        sc.close();
        InsertionSort(list);
    } main {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        LinkedList<Integer> list = new LinkedList<Integer>();
        for (int i = 0; i < n; i++){
            list.add(sc.nextInt());
        }
        sc.close();
        InsertionSort(list);
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc LinkedList<Integer> list = new LinkedList<Integer>(); list new LinkedList<Integer>() for (int i = 0; i < n; i++){
            list.add(sc.nextInt());
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            list.add(sc.nextInt());
        } {
            list.add(sc.nextInt());
        } list.add(sc.nextInt()) list.add list sc.nextInt() sc.nextInt sc sc.close() sc.close sc InsertionSort(list) InsertionSort list String[] args args static void InsertionSort(LinkedList<Integer> list){
        int key = 0;
        PrintList(list);
        for (int i = 1; i < list.size(); i++){
            key = list.get(i);
            int j = i - 1;
            while (j >= 0 && list.get(j) > key){
                swap(list, j+1, j);
                j--;
            }
            list.set(j+1 , key);
            PrintList(list);
        }
        
    } InsertionSort {
        int key = 0;
        PrintList(list);
        for (int i = 1; i < list.size(); i++){
            key = list.get(i);
            int j = i - 1;
            while (j >= 0 && list.get(j) > key){
                swap(list, j+1, j);
                j--;
            }
            list.set(j+1 , key);
            PrintList(list);
        }
        
    } int key = 0; key 0 PrintList(list) PrintList list for (int i = 1; i < list.size(); i++){
            key = list.get(i);
            int j = i - 1;
            while (j >= 0 && list.get(j) > key){
                swap(list, j+1, j);
                j--;
            }
            list.set(j+1 , key);
            PrintList(list);
        } int i = 1; int i = 1; i 1 i < list.size() i list.size() list.size list i++ i++ i {
            key = list.get(i);
            int j = i - 1;
            while (j >= 0 && list.get(j) > key){
                swap(list, j+1, j);
                j--;
            }
            list.set(j+1 , key);
            PrintList(list);
        } {
            key = list.get(i);
            int j = i - 1;
            while (j >= 0 && list.get(j) > key){
                swap(list, j+1, j);
                j--;
            }
            list.set(j+1 , key);
            PrintList(list);
        } key = list.get(i) key list.get(i) list.get list i int j = i - 1; j i - 1 i 1 while (j >= 0 && list.get(j) > key){
                swap(list, j+1, j);
                j--;
            } j >= 0 && list.get(j) > key j >= 0 j 0 list.get(j) > key list.get(j) list.get list j key {
                swap(list, j+1, j);
                j--;
            } swap(list, j+1, j) swap list j+1 j 1 j j-- j list.set(j+1 , key) list.set list j+1 j 1 key PrintList(list) PrintList list LinkedList<Integer> list list static void swap(LinkedList<Integer> list, int from, int to){
        int temp = list.get(from);
        list.set(from,list.get(to));
        list.set(to, temp);
     } swap {
        int temp = list.get(from);
        list.set(from,list.get(to));
        list.set(to, temp);
     } int temp = list.get(from); temp list.get(from) list.get list from list.set(from,list.get(to)) list.set list from list.get(to) list.get list to list.set(to, temp) list.set list to temp LinkedList<Integer> list list int from from int to to static void PrintList(LinkedList<Integer> list){
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < list.size(); i++){
            sb.append(list.get(i)+" ");
        }
        System.out.println(sb.deleteCharAt(sb.length()-1));
        
    } PrintList {
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < list.size(); i++){
            sb.append(list.get(i)+" ");
        }
        System.out.println(sb.deleteCharAt(sb.length()-1));
        
    } StringBuilder sb = new StringBuilder(); sb new StringBuilder() for (int i = 0; i < list.size(); i++){
            sb.append(list.get(i)+" ");
        } int i = 0; int i = 0; i 0 i < list.size() i list.size() list.size list i++ i++ i {
            sb.append(list.get(i)+" ");
        } {
            sb.append(list.get(i)+" ");
        } sb.append(list.get(i)+" ") sb.append sb list.get(i)+" " list.get(i) list.get list i " " System.out.println(sb.deleteCharAt(sb.length()-1)) System.out.println System.out System System.out sb.deleteCharAt(sb.length()-1) sb.deleteCharAt sb sb.length()-1 sb.length() sb.length sb 1 LinkedList<Integer> list list public class Main {
    public static void main(String[] args) throws IOException {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        LinkedList<Integer> list = new LinkedList<Integer>();
        for (int i = 0; i < n; i++){
            list.add(sc.nextInt());
        }
        sc.close();
        InsertionSort(list);
    }
    
    static void InsertionSort(LinkedList<Integer> list){
        int key = 0;
        PrintList(list);
        for (int i = 1; i < list.size(); i++){
            key = list.get(i);
            int j = i - 1;
            while (j >= 0 && list.get(j) > key){
                swap(list, j+1, j);
                j--;
            }
            list.set(j+1 , key);
            PrintList(list);
        }
        
    }
    static void swap(LinkedList<Integer> list, int from, int to){
        int temp = list.get(from);
        list.set(from,list.get(to));
        list.set(to, temp);
     }
    static void PrintList(LinkedList<Integer> list){
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < list.size(); i++){
            sb.append(list.get(i)+" ");
        }
        System.out.println(sb.deleteCharAt(sb.length()-1));
        
    }
} public class Main {
    public static void main(String[] args) throws IOException {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        LinkedList<Integer> list = new LinkedList<Integer>();
        for (int i = 0; i < n; i++){
            list.add(sc.nextInt());
        }
        sc.close();
        InsertionSort(list);
    }
    
    static void InsertionSort(LinkedList<Integer> list){
        int key = 0;
        PrintList(list);
        for (int i = 1; i < list.size(); i++){
            key = list.get(i);
            int j = i - 1;
            while (j >= 0 && list.get(j) > key){
                swap(list, j+1, j);
                j--;
            }
            list.set(j+1 , key);
            PrintList(list);
        }
        
    }
    static void swap(LinkedList<Integer> list, int from, int to){
        int temp = list.get(from);
        list.set(from,list.get(to));
        list.set(to, temp);
     }
    static void PrintList(LinkedList<Integer> list){
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < list.size(); i++){
            sb.append(list.get(i)+" ");
        }
        System.out.println(sb.deleteCharAt(sb.length()-1));
        
    }
} Main
import java.io.IOException;
import java.util.Scanner;
import java.util.LinkedList;

public class Main {
    public static void main(String[] args) throws IOException {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        LinkedList<Integer> list = new LinkedList<Integer>();
        for (int i = 0; i < n; i++){
            list.add(sc.nextInt());
        }
        sc.close();
        InsertionSort(list);
    }
    
    static void InsertionSort(LinkedList<Integer> list){
        int key = 0;
        PrintList(list);
        for (int i = 1; i < list.size(); i++){
            key = list.get(i);
            int j = i - 1;
            while (j >= 0 && list.get(j) > key){
                swap(list, j+1, j);
                j--;
            }
            list.set(j+1 , key);
            PrintList(list);
        }
        
    }
    static void swap(LinkedList<Integer> list, int from, int to){
        int temp = list.get(from);
        list.set(from,list.get(to));
        list.set(to, temp);
     }
    static void PrintList(LinkedList<Integer> list){
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < list.size(); i++){
            sb.append(list.get(i)+" ");
        }
        System.out.println(sb.deleteCharAt(sb.length()-1));
        
    }
}