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

void main(){
    int N = readln().chomp().to!int();
    string[] prenums = readln().split();
    int[] nums;
    foreach(string s; prenums){ nums ~= s.to!int(); }
    nums.map!(a => to!string(a)).join(" ").writeln();
    for(int i = 1; i < N; i++){
        int key = nums[i];
        if(nums[i-1] > key){
            int j = i;
            do{
                nums[j] = nums[j-1];
                j--;
            }while(j > 0 && nums[j-1] > key);
            nums[j] = key;
        }
        nums.map!(a => to!string(a)).join(" ").writeln();
    }
}