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);
	  }
	}
} import java.io.BufferedReader; BufferedReader java.io import java.io.IOException; IOException java.io import java.io.InputStreamReader; InputStreamReader java.io 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);
	  }
	}
} 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);
	  }
	} main {
	  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);
	  }
	} BufferedReader br = new BufferedReader(new InputStreamReader(System.in), 1); br new BufferedReader(new InputStreamReader(System.in), 1) String str = br.readLine(); str br.readLine() br.readLine br int len = Integer.parseInt(str); len Integer.parseInt(str) Integer.parseInt Integer str str = br.readLine() str br.readLine() br.readLine br String[] splitStr = str.split(" "); splitStr str.split(" ") str.split str " " int target[] = new int[len]; target new int[len] len for(int i = 0;i<len;i++){
	   target[i] = Integer.parseInt(splitStr[i]);
	  } int i = 0; int i = 0; i 0 i<len i len i++ i++ i {
	   target[i] = Integer.parseInt(splitStr[i]);
	  } {
	   target[i] = Integer.parseInt(splitStr[i]);
	  } target[i] = Integer.parseInt(splitStr[i]) target[i] target i Integer.parseInt(splitStr[i]) Integer.parseInt Integer splitStr[i] splitStr i StringBuffer sb_0 = new 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");
	    }
          } int v = 0; int v = 0; v 0 v < len v len v++ v++ v {
	    sb_0.append(target[v]);
	    if(v != len-1){
	      sb_0.append(" ");
	    //}else {
	      //sb_0.append("\n");
	    }
          } {
	    sb_0.append(target[v]);
	    if(v != len-1){
	      sb_0.append(" ");
	    //}else {
	      //sb_0.append("\n");
	    }
          } sb_0.append(target[v]) sb_0.append sb_0 target[v] target v if(v != len-1){
	      sb_0.append(" ");
	    //}else {
	      //sb_0.append("\n");
	    } v != len-1 v len-1 len 1 {
	      sb_0.append(" ");
	    //}else {
	      //sb_0.append("\n");
	    } sb_0.append(" ") sb_0.append sb_0 " " System.out.println(sb_0) System.out.println System.out System System.out 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);
	  } int i = 1; int i = 1; i 1 i<len i len i++ i++ 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);
	  } {
	    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);
	  } int cash = target[i]; cash target[i] target i int num = i-1; num i-1 i 1 while(num>= 0 && target[num] > cash){
	      target[num+1] = target[num];
	      num--;
	      target[num+1] = cash;
	    } num>= 0 && target[num] > cash num>= 0 num 0 target[num] > cash target[num] target num cash {
	      target[num+1] = target[num];
	      num--;
	      target[num+1] = cash;
	    } target[num+1] = target[num] target[num+1] target num+1 num 1 target[num] target num num-- num target[num+1] = cash target[num+1] target num+1 num 1 cash StringBuffer sb = new 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");
	      }
            } int v = 0; int v = 0; v 0 v < len v len v++ v++ v {
	      sb.append(target[v]);
	      if(v != len-1){
	        sb.append(" ");
	      //}else {
	        //sb.append("\n");
	      }
            } {
	      sb.append(target[v]);
	      if(v != len-1){
	        sb.append(" ");
	      //}else {
	        //sb.append("\n");
	      }
            } sb.append(target[v]) sb.append sb target[v] target v if(v != len-1){
	        sb.append(" ");
	      //}else {
	        //sb.append("\n");
	      } v != len-1 v len-1 len 1 {
	        sb.append(" ");
	      //}else {
	        //sb.append("\n");
	      } sb.append(" ") sb.append sb " " System.out.println(sb) System.out.println System.out System System.out sb String[] args args 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);
	  }
	}
} 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);
	  }
	}
} Main
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);
	  }
	}
}