import java.util.*;

class Main{
  public static void main(String args[]){

    int i= 0;
    int key = 0;
    int n = 0;

    Scanner sc = new Scanner(System.in);
    n = sc.nextInt();
    int A [] = new int[n];
    //input
    for(int k = 0; k<n; k++){
      A[k] = sc.nextInt();
    }

    //insertion sort
    for(int j = 1; j<A.length;j++){
      key = A[j];
      i = j -1;
      for(int k = 0; k<A.length-1;k++){
        System.out.printf("%d ", A[k]);
      }
      System.out.printf("%d\n",A[A.length-1]);

      while(i>=0 && A[i]>key){
        A[i+1] = A[i];
        i--;
      }
      A[i+1] = key;
    }

    //output
    for(int k = 0; k<A.length-1;k++){
      System.out.printf("%d ", A[k]);
    }
    System.out.printf("%d\n",A[A.length-1]);

  }
} import java.util.*; util.* java class Main{
  public static void main(String args[]){

    int i= 0;
    int key = 0;
    int n = 0;

    Scanner sc = new Scanner(System.in);
    n = sc.nextInt();
    int A [] = new int[n];
    //input
    for(int k = 0; k<n; k++){
      A[k] = sc.nextInt();
    }

    //insertion sort
    for(int j = 1; j<A.length;j++){
      key = A[j];
      i = j -1;
      for(int k = 0; k<A.length-1;k++){
        System.out.printf("%d ", A[k]);
      }
      System.out.printf("%d\n",A[A.length-1]);

      while(i>=0 && A[i]>key){
        A[i+1] = A[i];
        i--;
      }
      A[i+1] = key;
    }

    //output
    for(int k = 0; k<A.length-1;k++){
      System.out.printf("%d ", A[k]);
    }
    System.out.printf("%d\n",A[A.length-1]);

  }
} Main public static void main(String args[]){

    int i= 0;
    int key = 0;
    int n = 0;

    Scanner sc = new Scanner(System.in);
    n = sc.nextInt();
    int A [] = new int[n];
    //input
    for(int k = 0; k<n; k++){
      A[k] = sc.nextInt();
    }

    //insertion sort
    for(int j = 1; j<A.length;j++){
      key = A[j];
      i = j -1;
      for(int k = 0; k<A.length-1;k++){
        System.out.printf("%d ", A[k]);
      }
      System.out.printf("%d\n",A[A.length-1]);

      while(i>=0 && A[i]>key){
        A[i+1] = A[i];
        i--;
      }
      A[i+1] = key;
    }

    //output
    for(int k = 0; k<A.length-1;k++){
      System.out.printf("%d ", A[k]);
    }
    System.out.printf("%d\n",A[A.length-1]);

  } main {

    int i= 0;
    int key = 0;
    int n = 0;

    Scanner sc = new Scanner(System.in);
    n = sc.nextInt();
    int A [] = new int[n];
    //input
    for(int k = 0; k<n; k++){
      A[k] = sc.nextInt();
    }

    //insertion sort
    for(int j = 1; j<A.length;j++){
      key = A[j];
      i = j -1;
      for(int k = 0; k<A.length-1;k++){
        System.out.printf("%d ", A[k]);
      }
      System.out.printf("%d\n",A[A.length-1]);

      while(i>=0 && A[i]>key){
        A[i+1] = A[i];
        i--;
      }
      A[i+1] = key;
    }

    //output
    for(int k = 0; k<A.length-1;k++){
      System.out.printf("%d ", A[k]);
    }
    System.out.printf("%d\n",A[A.length-1]);

  } int i= 0; i 0 int key = 0; key 0 int n = 0; n 0 Scanner sc = new Scanner(System.in); sc new Scanner(System.in) n = sc.nextInt() n sc.nextInt() sc.nextInt sc int A [] = new int[n]; A new int[n] n for(int k = 0; k<n; k++){
      A[k] = sc.nextInt();
    } int k = 0; int k = 0; k 0 k<n k n k++ k++ k {
      A[k] = sc.nextInt();
    } {
      A[k] = sc.nextInt();
    } A[k] = sc.nextInt() A[k] A k sc.nextInt() sc.nextInt sc for(int j = 1; j<A.length;j++){
      key = A[j];
      i = j -1;
      for(int k = 0; k<A.length-1;k++){
        System.out.printf("%d ", A[k]);
      }
      System.out.printf("%d\n",A[A.length-1]);

      while(i>=0 && A[i]>key){
        A[i+1] = A[i];
        i--;
      }
      A[i+1] = key;
    } int j = 1; int j = 1; j 1 j<A.length j A.length A A.length j++ j++ j {
      key = A[j];
      i = j -1;
      for(int k = 0; k<A.length-1;k++){
        System.out.printf("%d ", A[k]);
      }
      System.out.printf("%d\n",A[A.length-1]);

      while(i>=0 && A[i]>key){
        A[i+1] = A[i];
        i--;
      }
      A[i+1] = key;
    } {
      key = A[j];
      i = j -1;
      for(int k = 0; k<A.length-1;k++){
        System.out.printf("%d ", A[k]);
      }
      System.out.printf("%d\n",A[A.length-1]);

      while(i>=0 && A[i]>key){
        A[i+1] = A[i];
        i--;
      }
      A[i+1] = key;
    } key = A[j] key A[j] A j i = j -1 i j -1 j 1 for(int k = 0; k<A.length-1;k++){
        System.out.printf("%d ", A[k]);
      } int k = 0; int k = 0; k 0 k<A.length-1 k A.length-1 A.length A A.length 1 k++ k++ k {
        System.out.printf("%d ", A[k]);
      } {
        System.out.printf("%d ", A[k]);
      } System.out.printf("%d ", A[k]) System.out.printf System.out System System.out "%d " A[k] A k System.out.printf("%d\n",A[A.length-1]) System.out.printf System.out System System.out "%d\n" A[A.length-1] A A.length-1 A.length A A.length 1 while(i>=0 && A[i]>key){
        A[i+1] = A[i];
        i--;
      } i>=0 && A[i]>key i>=0 i 0 A[i]>key A[i] A i key {
        A[i+1] = A[i];
        i--;
      } A[i+1] = A[i] A[i+1] A i+1 i 1 A[i] A i i-- i A[i+1] = key A[i+1] A i+1 i 1 key for(int k = 0; k<A.length-1;k++){
      System.out.printf("%d ", A[k]);
    } int k = 0; int k = 0; k 0 k<A.length-1 k A.length-1 A.length A A.length 1 k++ k++ k {
      System.out.printf("%d ", A[k]);
    } {
      System.out.printf("%d ", A[k]);
    } System.out.printf("%d ", A[k]) System.out.printf System.out System System.out "%d " A[k] A k System.out.printf("%d\n",A[A.length-1]) System.out.printf System.out System System.out "%d\n" A[A.length-1] A A.length-1 A.length A A.length 1 String args[] args
import java.util.*;

class Main{
  public static void main(String args[]){

    int i= 0;
    int key = 0;
    int n = 0;

    Scanner sc = new Scanner(System.in);
    n = sc.nextInt();
    int A [] = new int[n];
    //input
    for(int k = 0; k<n; k++){
      A[k] = sc.nextInt();
    }

    //insertion sort
    for(int j = 1; j<A.length;j++){
      key = A[j];
      i = j -1;
      for(int k = 0; k<A.length-1;k++){
        System.out.printf("%d ", A[k]);
      }
      System.out.printf("%d\n",A[A.length-1]);

      while(i>=0 && A[i]>key){
        A[i+1] = A[i];
        i--;
      }
      A[i+1] = key;
    }

    //output
    for(int k = 0; k<A.length-1;k++){
      System.out.printf("%d ", A[k]);
    }
    System.out.printf("%d\n",A[A.length-1]);

  }
}
