import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main{
	public static void main(String[] args) throws IOException {
	  BufferedReader br = new BufferedReader(new InputStreamReader(System.in), 1);
	  String str = br.readLine();
	  int len = Integer.parseInt(str); 
	  str = br.readLine();
	  String[] splitStr = str.split(" ");
	  
	  int target[] = new int[len];
	  
	  for(int i = 0;i<len;i++){
	   target[i] = Integer.parseInt(splitStr[i]);
	  }

      //???????????\???????????????
	  StringBuffer sb_0 = new StringBuffer();
	  for(int v = 0; v < len;v++){
	    sb_0.append(target[v]);
	    if(v != len-1){
	      sb_0.append(" ");
	    //}else {
	      //sb_0.append("\n");
	    }
          }
          System.out.println(sb_0);
      //???????????§??????????????????

	  for(int i = 1;i<len;i++){
	    int cash = target[i];
	    int num = i-1;
	    while(num>= 0 && target[num] > cash){
	      target[num+1] = target[num];
	      num--;
	      target[num+1] = cash;
	    }
            
            StringBuffer sb = new StringBuffer();
	    for(int v = 0; v < len;v++){
	      sb.append(target[v]);
	      if(v != len-1){
	        sb.append(" ");
	      //}else {
	        //sb.append("\n");
	      }
            }
            System.out.println(sb);
	  }
	}
}
/tmp/hf-datasets-cache/medium/datasets/42704881117311-config-parquet-and-info-qiankunmu-Project_CodeNet-896c9d36/hub/datasets--qiankunmu--Project_CodeNet_Python800_and_Java250/snapshots/c899fde44a77ba1cc14973ed3de064e4ff3aadc7/Project_CodeNet_Java250.tar.gz