/* ALDS1_1_A */
import java.io.*;

class Main
{

  public static void main(String[] args)
  {
    try{
      BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
      int n = Integer.parseInt(br.readLine());
      String[] str = br.readLine().split(" ");
      int[] array = new int[n];

      for(int i = 0; i < n; i++){
        array[i] = Integer.parseInt(str[i]);
      }
      insertionSort(array, array.length);

    }catch(Exception e){
      System.out.println(e);
    }
  }

  public static void insertionSort(int[] A, int N)
  {
    StringBuilder sb = new StringBuilder();
    sb.append(show(A));

    for(int i = 1; i < N; i++){
      int v = A[i];
      int j = i - 1;
      while(j >= 0 && A[j] > v){
        A[j+1] = A[j];
        j--;
      }
      A[j+1] = v;
      sb.append(show(A));
    }
    System.out.print(sb);
  }

  public static String show(int[] B)
  {
    StringBuilder sb = new StringBuilder();

    for(int i = 0; i < B.length; i++){
      sb.append(B[i]).append(" ");
    }
    sb.deleteCharAt(sb.length() - 1);
    sb.append("\n");

    return sb.toString();
  }
} import java.io.*; io.* java class Main
{

  public static void main(String[] args)
  {
    try{
      BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
      int n = Integer.parseInt(br.readLine());
      String[] str = br.readLine().split(" ");
      int[] array = new int[n];

      for(int i = 0; i < n; i++){
        array[i] = Integer.parseInt(str[i]);
      }
      insertionSort(array, array.length);

    }catch(Exception e){
      System.out.println(e);
    }
  }

  public static void insertionSort(int[] A, int N)
  {
    StringBuilder sb = new StringBuilder();
    sb.append(show(A));

    for(int i = 1; i < N; i++){
      int v = A[i];
      int j = i - 1;
      while(j >= 0 && A[j] > v){
        A[j+1] = A[j];
        j--;
      }
      A[j+1] = v;
      sb.append(show(A));
    }
    System.out.print(sb);
  }

  public static String show(int[] B)
  {
    StringBuilder sb = new StringBuilder();

    for(int i = 0; i < B.length; i++){
      sb.append(B[i]).append(" ");
    }
    sb.deleteCharAt(sb.length() - 1);
    sb.append("\n");

    return sb.toString();
  }
} Main public static void main(String[] args)
  {
    try{
      BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
      int n = Integer.parseInt(br.readLine());
      String[] str = br.readLine().split(" ");
      int[] array = new int[n];

      for(int i = 0; i < n; i++){
        array[i] = Integer.parseInt(str[i]);
      }
      insertionSort(array, array.length);

    }catch(Exception e){
      System.out.println(e);
    }
  } main {
    try{
      BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
      int n = Integer.parseInt(br.readLine());
      String[] str = br.readLine().split(" ");
      int[] array = new int[n];

      for(int i = 0; i < n; i++){
        array[i] = Integer.parseInt(str[i]);
      }
      insertionSort(array, array.length);

    }catch(Exception e){
      System.out.println(e);
    }
  } try{
      BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
      int n = Integer.parseInt(br.readLine());
      String[] str = br.readLine().split(" ");
      int[] array = new int[n];

      for(int i = 0; i < n; i++){
        array[i] = Integer.parseInt(str[i]);
      }
      insertionSort(array, array.length);

    }catch(Exception e){
      System.out.println(e);
    } catch(Exception e){
      System.out.println(e);
    } Exception e {
      System.out.println(e);
    } System.out.println(e) System.out.println System.out System System.out e {
      BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
      int n = Integer.parseInt(br.readLine());
      String[] str = br.readLine().split(" ");
      int[] array = new int[n];

      for(int i = 0; i < n; i++){
        array[i] = Integer.parseInt(str[i]);
      }
      insertionSort(array, array.length);

    } BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) int n = Integer.parseInt(br.readLine()); n Integer.parseInt(br.readLine()) Integer.parseInt Integer br.readLine() br.readLine br String[] str = br.readLine().split(" "); str br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " int[] array = new int[n]; array new int[n] n for(int i = 0; i < n; i++){
        array[i] = Integer.parseInt(str[i]);
      } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
        array[i] = Integer.parseInt(str[i]);
      } {
        array[i] = Integer.parseInt(str[i]);
      } array[i] = Integer.parseInt(str[i]) array[i] array i Integer.parseInt(str[i]) Integer.parseInt Integer str[i] str i insertionSort(array, array.length) insertionSort array array.length array array.length String[] args args public static void insertionSort(int[] A, int N)
  {
    StringBuilder sb = new StringBuilder();
    sb.append(show(A));

    for(int i = 1; i < N; i++){
      int v = A[i];
      int j = i - 1;
      while(j >= 0 && A[j] > v){
        A[j+1] = A[j];
        j--;
      }
      A[j+1] = v;
      sb.append(show(A));
    }
    System.out.print(sb);
  } insertionSort {
    StringBuilder sb = new StringBuilder();
    sb.append(show(A));

    for(int i = 1; i < N; i++){
      int v = A[i];
      int j = i - 1;
      while(j >= 0 && A[j] > v){
        A[j+1] = A[j];
        j--;
      }
      A[j+1] = v;
      sb.append(show(A));
    }
    System.out.print(sb);
  } StringBuilder sb = new StringBuilder(); sb new StringBuilder() sb.append(show(A)) sb.append sb show(A) show A for(int i = 1; i < N; i++){
      int v = A[i];
      int j = i - 1;
      while(j >= 0 && A[j] > v){
        A[j+1] = A[j];
        j--;
      }
      A[j+1] = v;
      sb.append(show(A));
    } int i = 1; int i = 1; i 1 i < N i N i++ i++ i {
      int v = A[i];
      int j = i - 1;
      while(j >= 0 && A[j] > v){
        A[j+1] = A[j];
        j--;
      }
      A[j+1] = v;
      sb.append(show(A));
    } {
      int v = A[i];
      int j = i - 1;
      while(j >= 0 && A[j] > v){
        A[j+1] = A[j];
        j--;
      }
      A[j+1] = v;
      sb.append(show(A));
    } int v = A[i]; v A[i] A i int j = i - 1; j i - 1 i 1 while(j >= 0 && A[j] > v){
        A[j+1] = A[j];
        j--;
      } j >= 0 && A[j] > v j >= 0 j 0 A[j] > v A[j] A j v {
        A[j+1] = A[j];
        j--;
      } A[j+1] = A[j] A[j+1] A j+1 j 1 A[j] A j j-- j A[j+1] = v A[j+1] A j+1 j 1 v sb.append(show(A)) sb.append sb show(A) show A System.out.print(sb) System.out.print System.out System System.out sb int[] A A int N N public static String show(int[] B)
  {
    StringBuilder sb = new StringBuilder();

    for(int i = 0; i < B.length; i++){
      sb.append(B[i]).append(" ");
    }
    sb.deleteCharAt(sb.length() - 1);
    sb.append("\n");

    return sb.toString();
  } show {
    StringBuilder sb = new StringBuilder();

    for(int i = 0; i < B.length; i++){
      sb.append(B[i]).append(" ");
    }
    sb.deleteCharAt(sb.length() - 1);
    sb.append("\n");

    return sb.toString();
  } StringBuilder sb = new StringBuilder(); sb new StringBuilder() for(int i = 0; i < B.length; i++){
      sb.append(B[i]).append(" ");
    } int i = 0; int i = 0; i 0 i < B.length i B.length B B.length i++ i++ i {
      sb.append(B[i]).append(" ");
    } {
      sb.append(B[i]).append(" ");
    } sb.append(B[i]).append(" ") sb.append(B[i]).append sb.append(B[i]) sb.append sb B[i] B i " " sb.deleteCharAt(sb.length() - 1) sb.deleteCharAt sb sb.length() - 1 sb.length() sb.length sb 1 sb.append("\n") sb.append sb "\n" return sb.toString(); sb.toString() sb.toString sb int[] B B
/* ALDS1_1_A */
import java.io.*;

class Main
{

  public static void main(String[] args)
  {
    try{
      BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
      int n = Integer.parseInt(br.readLine());
      String[] str = br.readLine().split(" ");
      int[] array = new int[n];

      for(int i = 0; i < n; i++){
        array[i] = Integer.parseInt(str[i]);
      }
      insertionSort(array, array.length);

    }catch(Exception e){
      System.out.println(e);
    }
  }

  public static void insertionSort(int[] A, int N)
  {
    StringBuilder sb = new StringBuilder();
    sb.append(show(A));

    for(int i = 1; i < N; i++){
      int v = A[i];
      int j = i - 1;
      while(j >= 0 && A[j] > v){
        A[j+1] = A[j];
        j--;
      }
      A[j+1] = v;
      sb.append(show(A));
    }
    System.out.print(sb);
  }

  public static String show(int[] B)
  {
    StringBuilder sb = new StringBuilder();

    for(int i = 0; i < B.length; i++){
      sb.append(B[i]).append(" ");
    }
    sb.deleteCharAt(sb.length() - 1);
    sb.append("\n");

    return sb.toString();
  }
}