import std.stdio;
import std.c.stdio;
import std.string;
import std.array;
import std.conv;

void Sort(ref int[] a,int n){

    int key,j;
    for(int i=1;i<n;i++){

	for(int k=0;k<n;k++){
	    writef("%d ",a[k]);
	}
	writeln();

	key = a[i];
	j = i - 1;
	while(j >= 0 && key < a[j]){
	    a[j+1] = a[j];
	    a[j] = key;
	    j--;
	}
    }

}

void main(){

    int n;
    int[] a;
    string[] s;
    scanf("%d\n",&n);
    a = new int[n];
    s = split(readln());
    for(int i=0;i<n;i++){
	a[i] = to!int(s[i]);
    }
    Sort(a,n);
    for(int i=0;i<n;i++){
	writef("%d ",a[i]);
    }
    writeln();

}