// 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]);
         }
         insertionSort(A, N);
      }
      catch (Exception e) {
         e.printStackTrace();
      }
   }
   public static void insertionSort(int[] A, int N) {
      for (int i = 1; i <= A.length - 1; i++) {
         for (int k = 0; k < N; k++) {
            System.out.print((k == N - 1) ? A[k] + "\n" : A[k] + " ");
         }
         int key = A[i];
         int j = i - 1;
         while (j >= 0 && A[j] > key) {
            A[j + 1] = A[j];
            j--;
         }
         A[j + 1] = key;
      }
      for (int k = 0; k < N; k++) {
         System.out.print((k == N - 1) ? A[k] + "\n" : A[k] + " ");
      }
   }
} 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]);
         }
         insertionSort(A, N);
      }
      catch (Exception e) {
         e.printStackTrace();
      }
   }
   public static void insertionSort(int[] A, int N) {
      for (int i = 1; i <= A.length - 1; i++) {
         for (int k = 0; k < N; k++) {
            System.out.print((k == N - 1) ? A[k] + "\n" : A[k] + " ");
         }
         int key = A[i];
         int j = i - 1;
         while (j >= 0 && A[j] > key) {
            A[j + 1] = A[j];
            j--;
         }
         A[j + 1] = key;
      }
      for (int k = 0; k < N; k++) {
         System.out.print((k == N - 1) ? A[k] + "\n" : A[k] + " ");
      }
   }
} 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]);
         }
         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]);
         }
         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]);
         }
         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]);
         }
         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 insertionSort(A, N) insertionSort A N String[] args args public static void insertionSort(int[] A, int N) {
      for (int i = 1; i <= A.length - 1; i++) {
         for (int k = 0; k < N; k++) {
            System.out.print((k == N - 1) ? A[k] + "\n" : A[k] + " ");
         }
         int key = A[i];
         int j = i - 1;
         while (j >= 0 && A[j] > key) {
            A[j + 1] = A[j];
            j--;
         }
         A[j + 1] = key;
      }
      for (int k = 0; k < N; k++) {
         System.out.print((k == N - 1) ? A[k] + "\n" : A[k] + " ");
      }
   } insertionSort {
      for (int i = 1; i <= A.length - 1; i++) {
         for (int k = 0; k < N; k++) {
            System.out.print((k == N - 1) ? A[k] + "\n" : A[k] + " ");
         }
         int key = A[i];
         int j = i - 1;
         while (j >= 0 && A[j] > key) {
            A[j + 1] = A[j];
            j--;
         }
         A[j + 1] = key;
      }
      for (int k = 0; k < N; k++) {
         System.out.print((k == N - 1) ? A[k] + "\n" : A[k] + " ");
      }
   } for (int i = 1; i <= A.length - 1; i++) {
         for (int k = 0; k < N; k++) {
            System.out.print((k == N - 1) ? A[k] + "\n" : A[k] + " ");
         }
         int key = A[i];
         int j = i - 1;
         while (j >= 0 && A[j] > key) {
            A[j + 1] = A[j];
            j--;
         }
         A[j + 1] = key;
      } int i = 1; int i = 1; i 1 i <= A.length - 1 i A.length - 1 A.length A A.length 1 i++ i++ i {
         for (int k = 0; k < N; k++) {
            System.out.print((k == N - 1) ? A[k] + "\n" : A[k] + " ");
         }
         int key = A[i];
         int j = i - 1;
         while (j >= 0 && A[j] > key) {
            A[j + 1] = A[j];
            j--;
         }
         A[j + 1] = key;
      } {
         for (int k = 0; k < N; k++) {
            System.out.print((k == N - 1) ? A[k] + "\n" : A[k] + " ");
         }
         int key = A[i];
         int j = i - 1;
         while (j >= 0 && A[j] > key) {
            A[j + 1] = A[j];
            j--;
         }
         A[j + 1] = key;
      } for (int k = 0; k < N; k++) {
            System.out.print((k == N - 1) ? A[k] + "\n" : A[k] + " ");
         } int k = 0; int k = 0; k 0 k < N k N k++ k++ k {
            System.out.print((k == N - 1) ? A[k] + "\n" : A[k] + " ");
         } {
            System.out.print((k == N - 1) ? A[k] + "\n" : A[k] + " ");
         } System.out.print((k == N - 1) ? A[k] + "\n" : A[k] + " ") System.out.print System.out System System.out (k == N - 1) ? A[k] + "\n" : A[k] + " " (k == N - 1) k N - 1 N 1 A[k] + "\n" A[k] A k "\n" A[k] + " " A[k] A k " " 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 for (int k = 0; k < N; k++) {
         System.out.print((k == N - 1) ? A[k] + "\n" : A[k] + " ");
      } int k = 0; int k = 0; k 0 k < N k N k++ k++ k {
         System.out.print((k == N - 1) ? A[k] + "\n" : A[k] + " ");
      } {
         System.out.print((k == N - 1) ? A[k] + "\n" : A[k] + " ");
      } System.out.print((k == N - 1) ? A[k] + "\n" : A[k] + " ") System.out.print System.out System System.out (k == N - 1) ? A[k] + "\n" : A[k] + " " (k == N - 1) k N - 1 N 1 A[k] + "\n" A[k] A k "\n" A[k] + " " A[k] A k " " 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]);
         }
         insertionSort(A, N);
      }
      catch (Exception e) {
         e.printStackTrace();
      }
   }
   public static void insertionSort(int[] A, int N) {
      for (int i = 1; i <= A.length - 1; i++) {
         for (int k = 0; k < N; k++) {
            System.out.print((k == N - 1) ? A[k] + "\n" : A[k] + " ");
         }
         int key = A[i];
         int j = i - 1;
         while (j >= 0 && A[j] > key) {
            A[j + 1] = A[j];
            j--;
         }
         A[j + 1] = key;
      }
      for (int k = 0; k < N; k++) {
         System.out.print((k == N - 1) ? A[k] + "\n" : A[k] + " ");
      }
   }
}