import java.util.Scanner;
import java.lang.Integer;
import java.lang.StringBuilder;
import java.lang.Math;

public class Main {
  private static int N;
  private static int[] a;

  private static void print() {
    StringBuilder result = new StringBuilder();
    for (int i = 0; i < N; i++) {
      result.append(a[i]);
      result.append(" ");
    }
    System.out.println(result.toString().trim());
  }

  private static void sort() {
    if (a.length == 1) {
      print();
      return;
    }
    int min = 0;

    for (int i = 1; i < N; i++) {
      print();
      int v = a[i];
      int j = i - 1;
      while (j >= 0 && v < a[j]) {
        // right shift
        a[j + 1] = a[j];
        j--;
      }
      a[j + 1] = v;
    }
    print();
  }

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

    // sort a.
    sort();
    // a is now sorted.


  }
} import java.util.Scanner; Scanner java.util import java.lang.Integer; Integer java.lang import java.lang.StringBuilder; StringBuilder java.lang import java.lang.Math; Math java.lang public class Main {
  private static int N;
  private static int[] a;

  private static void print() {
    StringBuilder result = new StringBuilder();
    for (int i = 0; i < N; i++) {
      result.append(a[i]);
      result.append(" ");
    }
    System.out.println(result.toString().trim());
  }

  private static void sort() {
    if (a.length == 1) {
      print();
      return;
    }
    int min = 0;

    for (int i = 1; i < N; i++) {
      print();
      int v = a[i];
      int j = i - 1;
      while (j >= 0 && v < a[j]) {
        // right shift
        a[j + 1] = a[j];
        j--;
      }
      a[j + 1] = v;
    }
    print();
  }

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

    // sort a.
    sort();
    // a is now sorted.


  }
} Main private static int N; N private static int[] a; a private static void print() {
    StringBuilder result = new StringBuilder();
    for (int i = 0; i < N; i++) {
      result.append(a[i]);
      result.append(" ");
    }
    System.out.println(result.toString().trim());
  } print {
    StringBuilder result = new StringBuilder();
    for (int i = 0; i < N; i++) {
      result.append(a[i]);
      result.append(" ");
    }
    System.out.println(result.toString().trim());
  } StringBuilder result = new StringBuilder(); result new StringBuilder() for (int i = 0; i < N; i++) {
      result.append(a[i]);
      result.append(" ");
    } int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
      result.append(a[i]);
      result.append(" ");
    } {
      result.append(a[i]);
      result.append(" ");
    } result.append(a[i]) result.append result a[i] a i result.append(" ") result.append result " " System.out.println(result.toString().trim()) System.out.println System.out System System.out result.toString().trim() result.toString().trim result.toString() result.toString result private static void sort() {
    if (a.length == 1) {
      print();
      return;
    }
    int min = 0;

    for (int i = 1; i < N; i++) {
      print();
      int v = a[i];
      int j = i - 1;
      while (j >= 0 && v < a[j]) {
        // right shift
        a[j + 1] = a[j];
        j--;
      }
      a[j + 1] = v;
    }
    print();
  } sort {
    if (a.length == 1) {
      print();
      return;
    }
    int min = 0;

    for (int i = 1; i < N; i++) {
      print();
      int v = a[i];
      int j = i - 1;
      while (j >= 0 && v < a[j]) {
        // right shift
        a[j + 1] = a[j];
        j--;
      }
      a[j + 1] = v;
    }
    print();
  } if (a.length == 1) {
      print();
      return;
    } a.length == 1 a.length a a.length 1 {
      print();
      return;
    } print() print return; int min = 0; min 0 for (int i = 1; i < N; i++) {
      print();
      int v = a[i];
      int j = i - 1;
      while (j >= 0 && v < a[j]) {
        // right shift
        a[j + 1] = a[j];
        j--;
      }
      a[j + 1] = v;
    } int i = 1; int i = 1; i 1 i < N i N i++ i++ i {
      print();
      int v = a[i];
      int j = i - 1;
      while (j >= 0 && v < a[j]) {
        // right shift
        a[j + 1] = a[j];
        j--;
      }
      a[j + 1] = v;
    } {
      print();
      int v = a[i];
      int j = i - 1;
      while (j >= 0 && v < a[j]) {
        // right shift
        a[j + 1] = a[j];
        j--;
      }
      a[j + 1] = v;
    } print() print int v = a[i]; v a[i] a i int j = i - 1; j i - 1 i 1 while (j >= 0 && v < a[j]) {
        // right shift
        a[j + 1] = a[j];
        j--;
      } j >= 0 && v < a[j] j >= 0 j 0 v < a[j] v a[j] a j {
        // right shift
        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] = v a[j + 1] a j + 1 j 1 v print() print public static void main(String[] args) {
    Scanner in = new Scanner(System.in);
    N = in.nextInt();
    a = new int[N];
    for (int i = 0; i < N; i++) {
      a[i] = in.nextInt();
    }

    // sort a.
    sort();
    // a is now sorted.


  } main {
    Scanner in = new Scanner(System.in);
    N = in.nextInt();
    a = new int[N];
    for (int i = 0; i < N; i++) {
      a[i] = in.nextInt();
    }

    // sort a.
    sort();
    // a is now sorted.


  } Scanner in = new Scanner(System.in); in new Scanner(System.in) N = in.nextInt() N in.nextInt() in.nextInt in a = new int[N] a new int[N] N for (int i = 0; i < N; i++) {
      a[i] = in.nextInt();
    } int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
      a[i] = in.nextInt();
    } {
      a[i] = in.nextInt();
    } a[i] = in.nextInt() a[i] a i in.nextInt() in.nextInt in sort() sort String[] args args public class Main {
  private static int N;
  private static int[] a;

  private static void print() {
    StringBuilder result = new StringBuilder();
    for (int i = 0; i < N; i++) {
      result.append(a[i]);
      result.append(" ");
    }
    System.out.println(result.toString().trim());
  }

  private static void sort() {
    if (a.length == 1) {
      print();
      return;
    }
    int min = 0;

    for (int i = 1; i < N; i++) {
      print();
      int v = a[i];
      int j = i - 1;
      while (j >= 0 && v < a[j]) {
        // right shift
        a[j + 1] = a[j];
        j--;
      }
      a[j + 1] = v;
    }
    print();
  }

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

    // sort a.
    sort();
    // a is now sorted.


  }
} public class Main {
  private static int N;
  private static int[] a;

  private static void print() {
    StringBuilder result = new StringBuilder();
    for (int i = 0; i < N; i++) {
      result.append(a[i]);
      result.append(" ");
    }
    System.out.println(result.toString().trim());
  }

  private static void sort() {
    if (a.length == 1) {
      print();
      return;
    }
    int min = 0;

    for (int i = 1; i < N; i++) {
      print();
      int v = a[i];
      int j = i - 1;
      while (j >= 0 && v < a[j]) {
        // right shift
        a[j + 1] = a[j];
        j--;
      }
      a[j + 1] = v;
    }
    print();
  }

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

    // sort a.
    sort();
    // a is now sorted.


  }
} Main
import java.util.Scanner;
import java.lang.Integer;
import java.lang.StringBuilder;
import java.lang.Math;

public class Main {
  private static int N;
  private static int[] a;

  private static void print() {
    StringBuilder result = new StringBuilder();
    for (int i = 0; i < N; i++) {
      result.append(a[i]);
      result.append(" ");
    }
    System.out.println(result.toString().trim());
  }

  private static void sort() {
    if (a.length == 1) {
      print();
      return;
    }
    int min = 0;

    for (int i = 1; i < N; i++) {
      print();
      int v = a[i];
      int j = i - 1;
      while (j >= 0 && v < a[j]) {
        // right shift
        a[j + 1] = a[j];
        j--;
      }
      a[j + 1] = v;
    }
    print();
  }

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

    // sort a.
    sort();
    // a is now sorted.


  }
}