import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        
        int n = Integer.valueOf(scan.next());
        Integer[] ns = new Integer[n];
        for(int i=0;i<n;i++) {
        	ns[i] = Integer.valueOf(scan.next());
        }
        for(int i = 1;i<=ns.length-1;i++) {
        	int cnt=0;
    	    for(int val:ns) {
    	    	if(cnt==n-1) break;
    	    	System.out.print(val+" ");
    	    	cnt++;
    	    }
    	    System.out.println(ns[n-1]);
    	    int key = ns[i];
    	    int j = i - 1;
    	    while(j >= 0 && ns[j] > key) {
    	        ns[j+1] = ns[j];
    	        j--;
    	    }
    	    ns[j+1] = key;
        }
        int cnt=0;
	    for(int val:ns) {
	    	if(cnt==n-1) break;
	    	System.out.print(val+" ");
	    	cnt++;
	    }
	    System.out.println(ns[n-1]);
        scan.close();
    }
} import java.util.Scanner; Scanner java.util public class Main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        
        int n = Integer.valueOf(scan.next());
        Integer[] ns = new Integer[n];
        for(int i=0;i<n;i++) {
        	ns[i] = Integer.valueOf(scan.next());
        }
        for(int i = 1;i<=ns.length-1;i++) {
        	int cnt=0;
    	    for(int val:ns) {
    	    	if(cnt==n-1) break;
    	    	System.out.print(val+" ");
    	    	cnt++;
    	    }
    	    System.out.println(ns[n-1]);
    	    int key = ns[i];
    	    int j = i - 1;
    	    while(j >= 0 && ns[j] > key) {
    	        ns[j+1] = ns[j];
    	        j--;
    	    }
    	    ns[j+1] = key;
        }
        int cnt=0;
	    for(int val:ns) {
	    	if(cnt==n-1) break;
	    	System.out.print(val+" ");
	    	cnt++;
	    }
	    System.out.println(ns[n-1]);
        scan.close();
    }
} Main public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        
        int n = Integer.valueOf(scan.next());
        Integer[] ns = new Integer[n];
        for(int i=0;i<n;i++) {
        	ns[i] = Integer.valueOf(scan.next());
        }
        for(int i = 1;i<=ns.length-1;i++) {
        	int cnt=0;
    	    for(int val:ns) {
    	    	if(cnt==n-1) break;
    	    	System.out.print(val+" ");
    	    	cnt++;
    	    }
    	    System.out.println(ns[n-1]);
    	    int key = ns[i];
    	    int j = i - 1;
    	    while(j >= 0 && ns[j] > key) {
    	        ns[j+1] = ns[j];
    	        j--;
    	    }
    	    ns[j+1] = key;
        }
        int cnt=0;
	    for(int val:ns) {
	    	if(cnt==n-1) break;
	    	System.out.print(val+" ");
	    	cnt++;
	    }
	    System.out.println(ns[n-1]);
        scan.close();
    } main {
        Scanner scan = new Scanner(System.in);
        
        int n = Integer.valueOf(scan.next());
        Integer[] ns = new Integer[n];
        for(int i=0;i<n;i++) {
        	ns[i] = Integer.valueOf(scan.next());
        }
        for(int i = 1;i<=ns.length-1;i++) {
        	int cnt=0;
    	    for(int val:ns) {
    	    	if(cnt==n-1) break;
    	    	System.out.print(val+" ");
    	    	cnt++;
    	    }
    	    System.out.println(ns[n-1]);
    	    int key = ns[i];
    	    int j = i - 1;
    	    while(j >= 0 && ns[j] > key) {
    	        ns[j+1] = ns[j];
    	        j--;
    	    }
    	    ns[j+1] = key;
        }
        int cnt=0;
	    for(int val:ns) {
	    	if(cnt==n-1) break;
	    	System.out.print(val+" ");
	    	cnt++;
	    }
	    System.out.println(ns[n-1]);
        scan.close();
    } Scanner scan = new Scanner(System.in); scan new Scanner(System.in) int n = Integer.valueOf(scan.next()); n Integer.valueOf(scan.next()) Integer.valueOf Integer scan.next() scan.next scan Integer[] ns = new Integer[n]; ns new Integer[n] n for(int i=0;i<n;i++) {
        	ns[i] = Integer.valueOf(scan.next());
        } int i=0; int i=0; i 0 i<n i n i++ i++ i {
        	ns[i] = Integer.valueOf(scan.next());
        } {
        	ns[i] = Integer.valueOf(scan.next());
        } ns[i] = Integer.valueOf(scan.next()) ns[i] ns i Integer.valueOf(scan.next()) Integer.valueOf Integer scan.next() scan.next scan for(int i = 1;i<=ns.length-1;i++) {
        	int cnt=0;
    	    for(int val:ns) {
    	    	if(cnt==n-1) break;
    	    	System.out.print(val+" ");
    	    	cnt++;
    	    }
    	    System.out.println(ns[n-1]);
    	    int key = ns[i];
    	    int j = i - 1;
    	    while(j >= 0 && ns[j] > key) {
    	        ns[j+1] = ns[j];
    	        j--;
    	    }
    	    ns[j+1] = key;
        } int i = 1; int i = 1; i 1 i<=ns.length-1 i ns.length-1 ns.length ns ns.length 1 i++ i++ i {
        	int cnt=0;
    	    for(int val:ns) {
    	    	if(cnt==n-1) break;
    	    	System.out.print(val+" ");
    	    	cnt++;
    	    }
    	    System.out.println(ns[n-1]);
    	    int key = ns[i];
    	    int j = i - 1;
    	    while(j >= 0 && ns[j] > key) {
    	        ns[j+1] = ns[j];
    	        j--;
    	    }
    	    ns[j+1] = key;
        } {
        	int cnt=0;
    	    for(int val:ns) {
    	    	if(cnt==n-1) break;
    	    	System.out.print(val+" ");
    	    	cnt++;
    	    }
    	    System.out.println(ns[n-1]);
    	    int key = ns[i];
    	    int j = i - 1;
    	    while(j >= 0 && ns[j] > key) {
    	        ns[j+1] = ns[j];
    	        j--;
    	    }
    	    ns[j+1] = key;
        } int cnt=0; cnt 0 for(int val:ns) {
    	    	if(cnt==n-1) break;
    	    	System.out.print(val+" ");
    	    	cnt++;
    	    } int val ns {
    	    	if(cnt==n-1) break;
    	    	System.out.print(val+" ");
    	    	cnt++;
    	    } {
    	    	if(cnt==n-1) break;
    	    	System.out.print(val+" ");
    	    	cnt++;
    	    } if(cnt==n-1) break; cnt==n-1 cnt n-1 n 1 break; System.out.print(val+" ") System.out.print System.out System System.out val+" " val " " cnt++ cnt System.out.println(ns[n-1]) System.out.println System.out System System.out ns[n-1] ns n-1 n 1 int key = ns[i]; key ns[i] ns i int j = i - 1; j i - 1 i 1 while(j >= 0 && ns[j] > key) {
    	        ns[j+1] = ns[j];
    	        j--;
    	    } j >= 0 && ns[j] > key j >= 0 j 0 ns[j] > key ns[j] ns j key {
    	        ns[j+1] = ns[j];
    	        j--;
    	    } ns[j+1] = ns[j] ns[j+1] ns j+1 j 1 ns[j] ns j j-- j ns[j+1] = key ns[j+1] ns j+1 j 1 key int cnt=0; cnt 0 for(int val:ns) {
	    	if(cnt==n-1) break;
	    	System.out.print(val+" ");
	    	cnt++;
	    } int val ns {
	    	if(cnt==n-1) break;
	    	System.out.print(val+" ");
	    	cnt++;
	    } {
	    	if(cnt==n-1) break;
	    	System.out.print(val+" ");
	    	cnt++;
	    } if(cnt==n-1) break; cnt==n-1 cnt n-1 n 1 break; System.out.print(val+" ") System.out.print System.out System System.out val+" " val " " cnt++ cnt System.out.println(ns[n-1]) System.out.println System.out System System.out ns[n-1] ns n-1 n 1 scan.close() scan.close scan String[] args args public class Main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        
        int n = Integer.valueOf(scan.next());
        Integer[] ns = new Integer[n];
        for(int i=0;i<n;i++) {
        	ns[i] = Integer.valueOf(scan.next());
        }
        for(int i = 1;i<=ns.length-1;i++) {
        	int cnt=0;
    	    for(int val:ns) {
    	    	if(cnt==n-1) break;
    	    	System.out.print(val+" ");
    	    	cnt++;
    	    }
    	    System.out.println(ns[n-1]);
    	    int key = ns[i];
    	    int j = i - 1;
    	    while(j >= 0 && ns[j] > key) {
    	        ns[j+1] = ns[j];
    	        j--;
    	    }
    	    ns[j+1] = key;
        }
        int cnt=0;
	    for(int val:ns) {
	    	if(cnt==n-1) break;
	    	System.out.print(val+" ");
	    	cnt++;
	    }
	    System.out.println(ns[n-1]);
        scan.close();
    }
} public class Main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        
        int n = Integer.valueOf(scan.next());
        Integer[] ns = new Integer[n];
        for(int i=0;i<n;i++) {
        	ns[i] = Integer.valueOf(scan.next());
        }
        for(int i = 1;i<=ns.length-1;i++) {
        	int cnt=0;
    	    for(int val:ns) {
    	    	if(cnt==n-1) break;
    	    	System.out.print(val+" ");
    	    	cnt++;
    	    }
    	    System.out.println(ns[n-1]);
    	    int key = ns[i];
    	    int j = i - 1;
    	    while(j >= 0 && ns[j] > key) {
    	        ns[j+1] = ns[j];
    	        j--;
    	    }
    	    ns[j+1] = key;
        }
        int cnt=0;
	    for(int val:ns) {
	    	if(cnt==n-1) break;
	    	System.out.print(val+" ");
	    	cnt++;
	    }
	    System.out.println(ns[n-1]);
        scan.close();
    }
} Main
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        
        int n = Integer.valueOf(scan.next());
        Integer[] ns = new Integer[n];
        for(int i=0;i<n;i++) {
        	ns[i] = Integer.valueOf(scan.next());
        }
        for(int i = 1;i<=ns.length-1;i++) {
        	int cnt=0;
    	    for(int val:ns) {
    	    	if(cnt==n-1) break;
    	    	System.out.print(val+" ");
    	    	cnt++;
    	    }
    	    System.out.println(ns[n-1]);
    	    int key = ns[i];
    	    int j = i - 1;
    	    while(j >= 0 && ns[j] > key) {
    	        ns[j+1] = ns[j];
    	        j--;
    	    }
    	    ns[j+1] = key;
        }
        int cnt=0;
	    for(int val:ns) {
	    	if(cnt==n-1) break;
	    	System.out.print(val+" ");
	    	cnt++;
	    }
	    System.out.println(ns[n-1]);
        scan.close();
    }
}
