// ALDS1_01 Insertion Sort
import java.io.*;

class Main {
   public static void main(String[] args) {
      BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

      try { 
         int N = Integer.parseInt(br.readLine());
         int[] A = new int[N];
         String[] input = br.readLine().split(" ");
         for (int i = 0; i < N; i++) {
            A[i] = Integer.parseInt(input[i]);
         }
         trace(A, N);
         insertionSort(A, N);
      }
      catch (Exception e) {
         e.printStackTrace();
      }
   }
   static void insertionSort(int[] A, int N) {
      for (int i = 1; i < A.length; i++) {
         int key = A[i];
         int j = i - 1;
         while (j >= 0 && A[j] > key) {
            A[j + 1] = A[j];
            j--;
         }
         A[j + 1] = key;
         trace(A, N);
      }
   }
   static void trace(int[] A, int N) {
      for (int i = 0; i < A.length; i++) {
         if (i < N - 1) {
            System.out.print(A[i] + " ");
         } else { 
            System.out.println(A[i]);
         }
      }
   }
} import java.io.*; io.* java class Main {
   public static void main(String[] args) {
      BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

      try { 
         int N = Integer.parseInt(br.readLine());
         int[] A = new int[N];
         String[] input = br.readLine().split(" ");
         for (int i = 0; i < N; i++) {
            A[i] = Integer.parseInt(input[i]);
         }
         trace(A, N);
         insertionSort(A, N);
      }
      catch (Exception e) {
         e.printStackTrace();
      }
   }
   static void insertionSort(int[] A, int N) {
      for (int i = 1; i < A.length; i++) {
         int key = A[i];
         int j = i - 1;
         while (j >= 0 && A[j] > key) {
            A[j + 1] = A[j];
            j--;
         }
         A[j + 1] = key;
         trace(A, N);
      }
   }
   static void trace(int[] A, int N) {
      for (int i = 0; i < A.length; i++) {
         if (i < N - 1) {
            System.out.print(A[i] + " ");
         } else { 
            System.out.println(A[i]);
         }
      }
   }
} Main public static void main(String[] args) {
      BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

      try { 
         int N = Integer.parseInt(br.readLine());
         int[] A = new int[N];
         String[] input = br.readLine().split(" ");
         for (int i = 0; i < N; i++) {
            A[i] = Integer.parseInt(input[i]);
         }
         trace(A, N);
         insertionSort(A, N);
      }
      catch (Exception e) {
         e.printStackTrace();
      }
   } main {
      BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

      try { 
         int N = Integer.parseInt(br.readLine());
         int[] A = new int[N];
         String[] input = br.readLine().split(" ");
         for (int i = 0; i < N; i++) {
            A[i] = Integer.parseInt(input[i]);
         }
         trace(A, N);
         insertionSort(A, N);
      }
      catch (Exception e) {
         e.printStackTrace();
      }
   } BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); br new BufferedReader(new InputStreamReader(System.in)) try { 
         int N = Integer.parseInt(br.readLine());
         int[] A = new int[N];
         String[] input = br.readLine().split(" ");
         for (int i = 0; i < N; i++) {
            A[i] = Integer.parseInt(input[i]);
         }
         trace(A, N);
         insertionSort(A, N);
      }
      catch (Exception e) {
         e.printStackTrace();
      } catch (Exception e) {
         e.printStackTrace();
      } Exception e {
         e.printStackTrace();
      } e.printStackTrace() e.printStackTrace e { 
         int N = Integer.parseInt(br.readLine());
         int[] A = new int[N];
         String[] input = br.readLine().split(" ");
         for (int i = 0; i < N; i++) {
            A[i] = Integer.parseInt(input[i]);
         }
         trace(A, N);
         insertionSort(A, N);
      } int N = Integer.parseInt(br.readLine()); N Integer.parseInt(br.readLine()) Integer.parseInt Integer br.readLine() br.readLine br int[] A = new int[N]; A new int[N] N String[] input = br.readLine().split(" "); input br.readLine().split(" ") br.readLine().split br.readLine() br.readLine br " " for (int i = 0; i < N; i++) {
            A[i] = Integer.parseInt(input[i]);
         } int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
            A[i] = Integer.parseInt(input[i]);
         } {
            A[i] = Integer.parseInt(input[i]);
         } A[i] = Integer.parseInt(input[i]) A[i] A i Integer.parseInt(input[i]) Integer.parseInt Integer input[i] input i trace(A, N) trace A N insertionSort(A, N) insertionSort A N String[] args args static void insertionSort(int[] A, int N) {
      for (int i = 1; i < A.length; i++) {
         int key = A[i];
         int j = i - 1;
         while (j >= 0 && A[j] > key) {
            A[j + 1] = A[j];
            j--;
         }
         A[j + 1] = key;
         trace(A, N);
      }
   } insertionSort {
      for (int i = 1; i < A.length; i++) {
         int key = A[i];
         int j = i - 1;
         while (j >= 0 && A[j] > key) {
            A[j + 1] = A[j];
            j--;
         }
         A[j + 1] = key;
         trace(A, N);
      }
   } for (int i = 1; i < A.length; i++) {
         int key = A[i];
         int j = i - 1;
         while (j >= 0 && A[j] > key) {
            A[j + 1] = A[j];
            j--;
         }
         A[j + 1] = key;
         trace(A, N);
      } int i = 1; int i = 1; i 1 i < A.length i A.length A A.length i++ i++ i {
         int key = A[i];
         int j = i - 1;
         while (j >= 0 && A[j] > key) {
            A[j + 1] = A[j];
            j--;
         }
         A[j + 1] = key;
         trace(A, N);
      } {
         int key = A[i];
         int j = i - 1;
         while (j >= 0 && A[j] > key) {
            A[j + 1] = A[j];
            j--;
         }
         A[j + 1] = key;
         trace(A, N);
      } int key = A[i]; key A[i] A i int j = i - 1; j i - 1 i 1 while (j >= 0 && A[j] > key) {
            A[j + 1] = A[j];
            j--;
         } j >= 0 && A[j] > key j >= 0 j 0 A[j] > key A[j] A j key {
            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] = key A[j + 1] A j + 1 j 1 key trace(A, N) trace A N int[] A A int N N static void trace(int[] A, int N) {
      for (int i = 0; i < A.length; i++) {
         if (i < N - 1) {
            System.out.print(A[i] + " ");
         } else { 
            System.out.println(A[i]);
         }
      }
   } trace {
      for (int i = 0; i < A.length; i++) {
         if (i < N - 1) {
            System.out.print(A[i] + " ");
         } else { 
            System.out.println(A[i]);
         }
      }
   } for (int i = 0; i < A.length; i++) {
         if (i < N - 1) {
            System.out.print(A[i] + " ");
         } else { 
            System.out.println(A[i]);
         }
      } int i = 0; int i = 0; i 0 i < A.length i A.length A A.length i++ i++ i {
         if (i < N - 1) {
            System.out.print(A[i] + " ");
         } else { 
            System.out.println(A[i]);
         }
      } {
         if (i < N - 1) {
            System.out.print(A[i] + " ");
         } else { 
            System.out.println(A[i]);
         }
      } if (i < N - 1) {
            System.out.print(A[i] + " ");
         } else { 
            System.out.println(A[i]);
         } i < N - 1 i N - 1 N 1 {
            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(A[i]);
         } System.out.println(A[i]) System.out.println System.out System System.out A[i] A i int[] A A int N N
// ALDS1_01 Insertion Sort
import java.io.*;

class Main {
   public static void main(String[] args) {
      BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

      try { 
         int N = Integer.parseInt(br.readLine());
         int[] A = new int[N];
         String[] input = br.readLine().split(" ");
         for (int i = 0; i < N; i++) {
            A[i] = Integer.parseInt(input[i]);
         }
         trace(A, N);
         insertionSort(A, N);
      }
      catch (Exception e) {
         e.printStackTrace();
      }
   }
   static void insertionSort(int[] A, int N) {
      for (int i = 1; i < A.length; i++) {
         int key = A[i];
         int j = i - 1;
         while (j >= 0 && A[j] > key) {
            A[j + 1] = A[j];
            j--;
         }
         A[j + 1] = key;
         trace(A, N);
      }
   }
   static void trace(int[] A, int N) {
      for (int i = 0; i < A.length; i++) {
         if (i < N - 1) {
            System.out.print(A[i] + " ");
         } else { 
            System.out.println(A[i]);
         }
      }
   }
}