import java.util.Scanner;

public class Main {

  static void trace(int[] a, int n) {
    for (int i = 0; i < n; i++) {
      if (i > 0) System.out.print(" ");
      System.out.print(a[i]);
    }
    System.out.println();
  }
    
  static void insertionSort(int[] a, int n) {
    int t, j;
    for (int i = 1; i < n; i++) {
      t = a[i];
      j = i - 1;
      while (j >= 0 && a[j] > t) {
        a[j + 1] = a[j];
        j--;
      }
      a[j + 1] = t;
      trace(a, n);
    }
  } 

  public static void main(String[] args) {
    Scanner stdIn = new Scanner(System.in);
    int n = stdIn.nextInt();
    int[] a = new int[n];
    for (int i = 0; i < n; i++) a[i] = stdIn.nextInt();
    trace(a, n);
    insertionSort(a, n);
  }
} import java.util.Scanner; Scanner java.util public class Main {

  static void trace(int[] a, int n) {
    for (int i = 0; i < n; i++) {
      if (i > 0) System.out.print(" ");
      System.out.print(a[i]);
    }
    System.out.println();
  }
    
  static void insertionSort(int[] a, int n) {
    int t, j;
    for (int i = 1; i < n; i++) {
      t = a[i];
      j = i - 1;
      while (j >= 0 && a[j] > t) {
        a[j + 1] = a[j];
        j--;
      }
      a[j + 1] = t;
      trace(a, n);
    }
  } 

  public static void main(String[] args) {
    Scanner stdIn = new Scanner(System.in);
    int n = stdIn.nextInt();
    int[] a = new int[n];
    for (int i = 0; i < n; i++) a[i] = stdIn.nextInt();
    trace(a, n);
    insertionSort(a, n);
  }
} Main static void trace(int[] a, int n) {
    for (int i = 0; i < n; i++) {
      if (i > 0) System.out.print(" ");
      System.out.print(a[i]);
    }
    System.out.println();
  } trace {
    for (int i = 0; i < n; i++) {
      if (i > 0) System.out.print(" ");
      System.out.print(a[i]);
    }
    System.out.println();
  } for (int i = 0; i < n; i++) {
      if (i > 0) System.out.print(" ");
      System.out.print(a[i]);
    } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
      if (i > 0) System.out.print(" ");
      System.out.print(a[i]);
    } {
      if (i > 0) System.out.print(" ");
      System.out.print(a[i]);
    } if (i > 0) System.out.print(" "); i > 0 i 0 System.out.print(" ") System.out.print System.out System System.out " " System.out.print(a[i]) System.out.print System.out System System.out a[i] a i System.out.println() System.out.println System.out System System.out int[] a a int n n static void insertionSort(int[] a, int n) {
    int t, j;
    for (int i = 1; i < n; i++) {
      t = a[i];
      j = i - 1;
      while (j >= 0 && a[j] > t) {
        a[j + 1] = a[j];
        j--;
      }
      a[j + 1] = t;
      trace(a, n);
    }
  } insertionSort {
    int t, j;
    for (int i = 1; i < n; i++) {
      t = a[i];
      j = i - 1;
      while (j >= 0 && a[j] > t) {
        a[j + 1] = a[j];
        j--;
      }
      a[j + 1] = t;
      trace(a, n);
    }
  } int t t j; j for (int i = 1; i < n; i++) {
      t = a[i];
      j = i - 1;
      while (j >= 0 && a[j] > t) {
        a[j + 1] = a[j];
        j--;
      }
      a[j + 1] = t;
      trace(a, n);
    } int i = 1; int i = 1; i 1 i < n i n i++ i++ i {
      t = a[i];
      j = i - 1;
      while (j >= 0 && a[j] > t) {
        a[j + 1] = a[j];
        j--;
      }
      a[j + 1] = t;
      trace(a, n);
    } {
      t = a[i];
      j = i - 1;
      while (j >= 0 && a[j] > t) {
        a[j + 1] = a[j];
        j--;
      }
      a[j + 1] = t;
      trace(a, n);
    } t = a[i] t a[i] a i j = i - 1 j i - 1 i 1 while (j >= 0 && a[j] > t) {
        a[j + 1] = a[j];
        j--;
      } j >= 0 && a[j] > t j >= 0 j 0 a[j] > t a[j] a j t {
        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] = t a[j + 1] a j + 1 j 1 t trace(a, n) trace a n int[] a a int n n public static void main(String[] args) {
    Scanner stdIn = new Scanner(System.in);
    int n = stdIn.nextInt();
    int[] a = new int[n];
    for (int i = 0; i < n; i++) a[i] = stdIn.nextInt();
    trace(a, n);
    insertionSort(a, n);
  } main {
    Scanner stdIn = new Scanner(System.in);
    int n = stdIn.nextInt();
    int[] a = new int[n];
    for (int i = 0; i < n; i++) a[i] = stdIn.nextInt();
    trace(a, n);
    insertionSort(a, n);
  } Scanner stdIn = new Scanner(System.in); stdIn new Scanner(System.in) int n = stdIn.nextInt(); n stdIn.nextInt() stdIn.nextInt stdIn int[] a = new int[n]; a new int[n] n for (int i = 0; i < n; i++) a[i] = stdIn.nextInt(); int i = 0; int i = 0; i 0 i < n i n i++ i++ i a[i] = stdIn.nextInt(); a[i] = stdIn.nextInt() a[i] a i stdIn.nextInt() stdIn.nextInt stdIn trace(a, n) trace a n insertionSort(a, n) insertionSort a n String[] args args public class Main {

  static void trace(int[] a, int n) {
    for (int i = 0; i < n; i++) {
      if (i > 0) System.out.print(" ");
      System.out.print(a[i]);
    }
    System.out.println();
  }
    
  static void insertionSort(int[] a, int n) {
    int t, j;
    for (int i = 1; i < n; i++) {
      t = a[i];
      j = i - 1;
      while (j >= 0 && a[j] > t) {
        a[j + 1] = a[j];
        j--;
      }
      a[j + 1] = t;
      trace(a, n);
    }
  } 

  public static void main(String[] args) {
    Scanner stdIn = new Scanner(System.in);
    int n = stdIn.nextInt();
    int[] a = new int[n];
    for (int i = 0; i < n; i++) a[i] = stdIn.nextInt();
    trace(a, n);
    insertionSort(a, n);
  }
} public class Main {

  static void trace(int[] a, int n) {
    for (int i = 0; i < n; i++) {
      if (i > 0) System.out.print(" ");
      System.out.print(a[i]);
    }
    System.out.println();
  }
    
  static void insertionSort(int[] a, int n) {
    int t, j;
    for (int i = 1; i < n; i++) {
      t = a[i];
      j = i - 1;
      while (j >= 0 && a[j] > t) {
        a[j + 1] = a[j];
        j--;
      }
      a[j + 1] = t;
      trace(a, n);
    }
  } 

  public static void main(String[] args) {
    Scanner stdIn = new Scanner(System.in);
    int n = stdIn.nextInt();
    int[] a = new int[n];
    for (int i = 0; i < n; i++) a[i] = stdIn.nextInt();
    trace(a, n);
    insertionSort(a, n);
  }
} Main
import java.util.Scanner;

public class Main {

  static void trace(int[] a, int n) {
    for (int i = 0; i < n; i++) {
      if (i > 0) System.out.print(" ");
      System.out.print(a[i]);
    }
    System.out.println();
  }
    
  static void insertionSort(int[] a, int n) {
    int t, j;
    for (int i = 1; i < n; i++) {
      t = a[i];
      j = i - 1;
      while (j >= 0 && a[j] > t) {
        a[j + 1] = a[j];
        j--;
      }
      a[j + 1] = t;
      trace(a, n);
    }
  } 

  public static void main(String[] args) {
    Scanner stdIn = new Scanner(System.in);
    int n = stdIn.nextInt();
    int[] a = new int[n];
    for (int i = 0; i < n; i++) a[i] = stdIn.nextInt();
    trace(a, n);
    insertionSort(a, n);
  }
}