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

  public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        String[] arr = br.readLine().split(" ");
        int[] A = new int[n];
        for (int i = 0; i < n; i++){
          A[i] = Integer.parseInt(arr[i]);
        }
        insertionSort(A, n);
    }
    
    static void insertionSort(int[] A, int n){
      printArray(A);
      for (int i = 1; i < n; i++){
        int v = A[i];
        int j = i - 1;
        while (j >= 0 && A[j] > v){
          swap(A, j+1, j);
          j--;
        }
        A[j+1] = v;
        printArray(A);
      }
    }
    
    static void swap(int[] A, int i, int j){
      int tmp = A[i];
      A[i] = A[j];
      A[j] = tmp;
    }
    
    static void printArray(int[] A){
      StringBuilder sb = new StringBuilder();
      for (int i = 0; i < A.length; i++){
        sb.append(String.valueOf(A[i]));
        if (i != A.length - 1){
          sb.append(" ");
        }
      }
      System.out.println(sb.toString());
    }
  } import java.io.IOException; IOException java.io import java.io.BufferedReader; BufferedReader 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));
        int n = Integer.parseInt(br.readLine());
        String[] arr = br.readLine().split(" ");
        int[] A = new int[n];
        for (int i = 0; i < n; i++){
          A[i] = Integer.parseInt(arr[i]);
        }
        insertionSort(A, n);
    }
    
    static void insertionSort(int[] A, int n){
      printArray(A);
      for (int i = 1; i < n; i++){
        int v = A[i];
        int j = i - 1;
        while (j >= 0 && A[j] > v){
          swap(A, j+1, j);
          j--;
        }
        A[j+1] = v;
        printArray(A);
      }
    }
    
    static void swap(int[] A, int i, int j){
      int tmp = A[i];
      A[i] = A[j];
      A[j] = tmp;
    }
    
    static void printArray(int[] A){
      StringBuilder sb = new StringBuilder();
      for (int i = 0; i < A.length; i++){
        sb.append(String.valueOf(A[i]));
        if (i != A.length - 1){
          sb.append(" ");
        }
      }
      System.out.println(sb.toString());
    }
  } Main public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        String[] arr = br.readLine().split(" ");
        int[] A = new int[n];
        for (int i = 0; i < n; i++){
          A[i] = Integer.parseInt(arr[i]);
        }
        insertionSort(A, n);
    } main {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        String[] arr = br.readLine().split(" ");
        int[] A = new int[n];
        for (int i = 0; i < n; i++){
          A[i] = Integer.parseInt(arr[i]);
        }
        insertionSort(A, n);
    } 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[] arr = br.readLine().split(" "); arr br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " int[] A = new int[n]; A new int[n] n for (int i = 0; i < n; i++){
          A[i] = Integer.parseInt(arr[i]);
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
          A[i] = Integer.parseInt(arr[i]);
        } {
          A[i] = Integer.parseInt(arr[i]);
        } A[i] = Integer.parseInt(arr[i]) A[i] A i Integer.parseInt(arr[i]) Integer.parseInt Integer arr[i] arr i insertionSort(A, n) insertionSort A n String[] args args static void insertionSort(int[] A, int n){
      printArray(A);
      for (int i = 1; i < n; i++){
        int v = A[i];
        int j = i - 1;
        while (j >= 0 && A[j] > v){
          swap(A, j+1, j);
          j--;
        }
        A[j+1] = v;
        printArray(A);
      }
    } insertionSort {
      printArray(A);
      for (int i = 1; i < n; i++){
        int v = A[i];
        int j = i - 1;
        while (j >= 0 && A[j] > v){
          swap(A, j+1, j);
          j--;
        }
        A[j+1] = v;
        printArray(A);
      }
    } printArray(A) printArray A for (int i = 1; i < n; i++){
        int v = A[i];
        int j = i - 1;
        while (j >= 0 && A[j] > v){
          swap(A, j+1, j);
          j--;
        }
        A[j+1] = v;
        printArray(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){
          swap(A, j+1, j);
          j--;
        }
        A[j+1] = v;
        printArray(A);
      } {
        int v = A[i];
        int j = i - 1;
        while (j >= 0 && A[j] > v){
          swap(A, j+1, j);
          j--;
        }
        A[j+1] = v;
        printArray(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){
          swap(A, j+1, j);
          j--;
        } j >= 0 && A[j] > v j >= 0 j 0 A[j] > v A[j] A j v {
          swap(A, j+1, j);
          j--;
        } swap(A, j+1, j) swap A j+1 j 1 j j-- j A[j+1] = v A[j+1] A j+1 j 1 v printArray(A) printArray A int[] A A int n n static void swap(int[] A, int i, int j){
      int tmp = A[i];
      A[i] = A[j];
      A[j] = tmp;
    } swap {
      int tmp = A[i];
      A[i] = A[j];
      A[j] = tmp;
    } int tmp = A[i]; tmp A[i] A i A[i] = A[j] A[i] A i A[j] A j A[j] = tmp A[j] A j tmp int[] A A int i i int j j static void printArray(int[] A){
      StringBuilder sb = new StringBuilder();
      for (int i = 0; i < A.length; i++){
        sb.append(String.valueOf(A[i]));
        if (i != A.length - 1){
          sb.append(" ");
        }
      }
      System.out.println(sb.toString());
    } printArray {
      StringBuilder sb = new StringBuilder();
      for (int i = 0; i < A.length; i++){
        sb.append(String.valueOf(A[i]));
        if (i != A.length - 1){
          sb.append(" ");
        }
      }
      System.out.println(sb.toString());
    } StringBuilder sb = new StringBuilder(); sb new StringBuilder() for (int i = 0; i < A.length; i++){
        sb.append(String.valueOf(A[i]));
        if (i != A.length - 1){
          sb.append(" ");
        }
      } int i = 0; int i = 0; i 0 i < A.length i A.length A A.length i++ i++ i {
        sb.append(String.valueOf(A[i]));
        if (i != A.length - 1){
          sb.append(" ");
        }
      } {
        sb.append(String.valueOf(A[i]));
        if (i != A.length - 1){
          sb.append(" ");
        }
      } sb.append(String.valueOf(A[i])) sb.append sb String.valueOf(A[i]) String.valueOf String A[i] A i if (i != A.length - 1){
          sb.append(" ");
        } i != A.length - 1 i A.length - 1 A.length A A.length 1 {
          sb.append(" ");
        } sb.append(" ") sb.append sb " " System.out.println(sb.toString()) System.out.println System.out System System.out sb.toString() sb.toString sb int[] A A public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        String[] arr = br.readLine().split(" ");
        int[] A = new int[n];
        for (int i = 0; i < n; i++){
          A[i] = Integer.parseInt(arr[i]);
        }
        insertionSort(A, n);
    }
    
    static void insertionSort(int[] A, int n){
      printArray(A);
      for (int i = 1; i < n; i++){
        int v = A[i];
        int j = i - 1;
        while (j >= 0 && A[j] > v){
          swap(A, j+1, j);
          j--;
        }
        A[j+1] = v;
        printArray(A);
      }
    }
    
    static void swap(int[] A, int i, int j){
      int tmp = A[i];
      A[i] = A[j];
      A[j] = tmp;
    }
    
    static void printArray(int[] A){
      StringBuilder sb = new StringBuilder();
      for (int i = 0; i < A.length; i++){
        sb.append(String.valueOf(A[i]));
        if (i != A.length - 1){
          sb.append(" ");
        }
      }
      System.out.println(sb.toString());
    }
  } public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        String[] arr = br.readLine().split(" ");
        int[] A = new int[n];
        for (int i = 0; i < n; i++){
          A[i] = Integer.parseInt(arr[i]);
        }
        insertionSort(A, n);
    }
    
    static void insertionSort(int[] A, int n){
      printArray(A);
      for (int i = 1; i < n; i++){
        int v = A[i];
        int j = i - 1;
        while (j >= 0 && A[j] > v){
          swap(A, j+1, j);
          j--;
        }
        A[j+1] = v;
        printArray(A);
      }
    }
    
    static void swap(int[] A, int i, int j){
      int tmp = A[i];
      A[i] = A[j];
      A[j] = tmp;
    }
    
    static void printArray(int[] A){
      StringBuilder sb = new StringBuilder();
      for (int i = 0; i < A.length; i++){
        sb.append(String.valueOf(A[i]));
        if (i != A.length - 1){
          sb.append(" ");
        }
      }
      System.out.println(sb.toString());
    }
  } Main
  import java.io.IOException;
  import java.io.BufferedReader;
  import java.io.InputStreamReader;

  public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        String[] arr = br.readLine().split(" ");
        int[] A = new int[n];
        for (int i = 0; i < n; i++){
          A[i] = Integer.parseInt(arr[i]);
        }
        insertionSort(A, n);
    }
    
    static void insertionSort(int[] A, int n){
      printArray(A);
      for (int i = 1; i < n; i++){
        int v = A[i];
        int j = i - 1;
        while (j >= 0 && A[j] > v){
          swap(A, j+1, j);
          j--;
        }
        A[j+1] = v;
        printArray(A);
      }
    }
    
    static void swap(int[] A, int i, int j){
      int tmp = A[i];
      A[i] = A[j];
      A[j] = tmp;
    }
    
    static void printArray(int[] A){
      StringBuilder sb = new StringBuilder();
      for (int i = 0; i < A.length; i++){
        sb.append(String.valueOf(A[i]));
        if (i != A.length - 1){
          sb.append(" ");
        }
      }
      System.out.println(sb.toString());
    }
  }