import java.util.Scanner;

class Main{
  public static void main(String[] ags){
    Scanner nyuryoku = new Scanner(System.in);
    int N = nyuryoku.nextInt();
    int[] A = new int[N];
    for (int i = 0; i < N; i++){
      A[i] = nyuryoku.nextInt();
    }
      show(A, N);
      insertionSort(A, N);
  }
  static void insertionSort(int[] A, int N){
    for(int i = 1; i < N; i++){
      int tmp = A[i];
      int j;
      for (j = i; j > 0 && A[j-1] > tmp; j--)
        A[j] = A[j - 1];
      A[j] = tmp;
      show(A, N);
    }
  }
  static void show(int[] A, int N){
    System.out.print(A[0]);
    for (int i = 1; i < N; i++){
      System.out.print(" " + A[i]);
    }
    System.out.println();
  }
}
 import java.util.Scanner; Scanner java.util class Main{
  public static void main(String[] ags){
    Scanner nyuryoku = new Scanner(System.in);
    int N = nyuryoku.nextInt();
    int[] A = new int[N];
    for (int i = 0; i < N; i++){
      A[i] = nyuryoku.nextInt();
    }
      show(A, N);
      insertionSort(A, N);
  }
  static void insertionSort(int[] A, int N){
    for(int i = 1; i < N; i++){
      int tmp = A[i];
      int j;
      for (j = i; j > 0 && A[j-1] > tmp; j--)
        A[j] = A[j - 1];
      A[j] = tmp;
      show(A, N);
    }
  }
  static void show(int[] A, int N){
    System.out.print(A[0]);
    for (int i = 1; i < N; i++){
      System.out.print(" " + A[i]);
    }
    System.out.println();
  }
} Main public static void main(String[] ags){
    Scanner nyuryoku = new Scanner(System.in);
    int N = nyuryoku.nextInt();
    int[] A = new int[N];
    for (int i = 0; i < N; i++){
      A[i] = nyuryoku.nextInt();
    }
      show(A, N);
      insertionSort(A, N);
  } main {
    Scanner nyuryoku = new Scanner(System.in);
    int N = nyuryoku.nextInt();
    int[] A = new int[N];
    for (int i = 0; i < N; i++){
      A[i] = nyuryoku.nextInt();
    }
      show(A, N);
      insertionSort(A, N);
  } Scanner nyuryoku = new Scanner(System.in); nyuryoku new Scanner(System.in) int N = nyuryoku.nextInt(); N nyuryoku.nextInt() nyuryoku.nextInt nyuryoku int[] A = new int[N]; A new int[N] N for (int i = 0; i < N; i++){
      A[i] = nyuryoku.nextInt();
    } int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
      A[i] = nyuryoku.nextInt();
    } {
      A[i] = nyuryoku.nextInt();
    } A[i] = nyuryoku.nextInt() A[i] A i nyuryoku.nextInt() nyuryoku.nextInt nyuryoku show(A, N) show A N insertionSort(A, N) insertionSort A N String[] ags ags static void insertionSort(int[] A, int N){
    for(int i = 1; i < N; i++){
      int tmp = A[i];
      int j;
      for (j = i; j > 0 && A[j-1] > tmp; j--)
        A[j] = A[j - 1];
      A[j] = tmp;
      show(A, N);
    }
  } insertionSort {
    for(int i = 1; i < N; i++){
      int tmp = A[i];
      int j;
      for (j = i; j > 0 && A[j-1] > tmp; j--)
        A[j] = A[j - 1];
      A[j] = tmp;
      show(A, N);
    }
  } for(int i = 1; i < N; i++){
      int tmp = A[i];
      int j;
      for (j = i; j > 0 && A[j-1] > tmp; j--)
        A[j] = A[j - 1];
      A[j] = tmp;
      show(A, N);
    } int i = 1; int i = 1; i 1 i < N i N i++ i++ i {
      int tmp = A[i];
      int j;
      for (j = i; j > 0 && A[j-1] > tmp; j--)
        A[j] = A[j - 1];
      A[j] = tmp;
      show(A, N);
    } {
      int tmp = A[i];
      int j;
      for (j = i; j > 0 && A[j-1] > tmp; j--)
        A[j] = A[j - 1];
      A[j] = tmp;
      show(A, N);
    } int tmp = A[i]; tmp A[i] A i int j; j for (j = i; j > 0 && A[j-1] > tmp; j--)
        A[j] = A[j - 1]; j = i; j = i j i j > 0 && A[j-1] > tmp j > 0 j 0 A[j-1] > tmp A[j-1] A j-1 j 1 tmp j-- j-- j A[j] = A[j - 1]; A[j] = A[j - 1] A[j] A j A[j - 1] A j - 1 j 1 A[j] = tmp A[j] A j tmp show(A, N) show A N int[] A A int N N static void show(int[] A, int N){
    System.out.print(A[0]);
    for (int i = 1; i < N; i++){
      System.out.print(" " + A[i]);
    }
    System.out.println();
  } show {
    System.out.print(A[0]);
    for (int i = 1; i < N; i++){
      System.out.print(" " + A[i]);
    }
    System.out.println();
  } System.out.print(A[0]) System.out.print System.out System System.out A[0] A 0 for (int i = 1; i < N; i++){
      System.out.print(" " + A[i]);
    } int i = 1; int i = 1; i 1 i < N i N i++ i++ i {
      System.out.print(" " + A[i]);
    } {
      System.out.print(" " + A[i]);
    } System.out.print(" " + A[i]) System.out.print System.out System System.out " " + A[i] " " A[i] A i System.out.println() System.out.println System.out System System.out int[] A A int N N
import java.util.Scanner;

class Main{
  public static void main(String[] ags){
    Scanner nyuryoku = new Scanner(System.in);
    int N = nyuryoku.nextInt();
    int[] A = new int[N];
    for (int i = 0; i < N; i++){
      A[i] = nyuryoku.nextInt();
    }
      show(A, N);
      insertionSort(A, N);
  }
  static void insertionSort(int[] A, int N){
    for(int i = 1; i < N; i++){
      int tmp = A[i];
      int j;
      for (j = i; j > 0 && A[j-1] > tmp; j--)
        A[j] = A[j - 1];
      A[j] = tmp;
      show(A, N);
    }
  }
  static void show(int[] A, int N){
    System.out.print(A[0]);
    for (int i = 1; i < N; i++){
      System.out.print(" " + A[i]);
    }
    System.out.println();
  }
}

