import java.io.*;
import java.util.*;

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

    Scanner scan=new Scanner(System.in);
    int n=Integer.parseInt(scan.next());
    int[] array=new int[n];
    for(int i=0;i<array.length;i++){
      array[i]=Integer.parseInt(scan.next());
    }

    for(int k=0;k<array.length;k++){
      if(k<array.length-1){
        System.out.print(array[k]);
        System.out.print(" ");
      }else{
        System.out.println(array[k]);
      }
    }

    //ソート
    for (int j = 1; j < array.length; j++) {
            int key = array[j];
            int i = j - 1;
            while (i >= 0 && array[i] > key) {
                array[i + 1] = array[i];
                i--;
            }
            array[i + 1] = key;
            for(int k=0;k<array.length;k++){
              if(k<array.length-1){
                System.out.print(array[k]);
                System.out.print(" ");
              }else{
                System.out.println(array[k]);
              }
            }
        }
  }
}
 import java.io.*; io.* java import java.util.*; util.* java class Main{
  public static void main(String[] args) throws IOException{

    Scanner scan=new Scanner(System.in);
    int n=Integer.parseInt(scan.next());
    int[] array=new int[n];
    for(int i=0;i<array.length;i++){
      array[i]=Integer.parseInt(scan.next());
    }

    for(int k=0;k<array.length;k++){
      if(k<array.length-1){
        System.out.print(array[k]);
        System.out.print(" ");
      }else{
        System.out.println(array[k]);
      }
    }

    //ソート
    for (int j = 1; j < array.length; j++) {
            int key = array[j];
            int i = j - 1;
            while (i >= 0 && array[i] > key) {
                array[i + 1] = array[i];
                i--;
            }
            array[i + 1] = key;
            for(int k=0;k<array.length;k++){
              if(k<array.length-1){
                System.out.print(array[k]);
                System.out.print(" ");
              }else{
                System.out.println(array[k]);
              }
            }
        }
  }
} Main public static void main(String[] args) throws IOException{

    Scanner scan=new Scanner(System.in);
    int n=Integer.parseInt(scan.next());
    int[] array=new int[n];
    for(int i=0;i<array.length;i++){
      array[i]=Integer.parseInt(scan.next());
    }

    for(int k=0;k<array.length;k++){
      if(k<array.length-1){
        System.out.print(array[k]);
        System.out.print(" ");
      }else{
        System.out.println(array[k]);
      }
    }

    //ソート
    for (int j = 1; j < array.length; j++) {
            int key = array[j];
            int i = j - 1;
            while (i >= 0 && array[i] > key) {
                array[i + 1] = array[i];
                i--;
            }
            array[i + 1] = key;
            for(int k=0;k<array.length;k++){
              if(k<array.length-1){
                System.out.print(array[k]);
                System.out.print(" ");
              }else{
                System.out.println(array[k]);
              }
            }
        }
  } main {

    Scanner scan=new Scanner(System.in);
    int n=Integer.parseInt(scan.next());
    int[] array=new int[n];
    for(int i=0;i<array.length;i++){
      array[i]=Integer.parseInt(scan.next());
    }

    for(int k=0;k<array.length;k++){
      if(k<array.length-1){
        System.out.print(array[k]);
        System.out.print(" ");
      }else{
        System.out.println(array[k]);
      }
    }

    //ソート
    for (int j = 1; j < array.length; j++) {
            int key = array[j];
            int i = j - 1;
            while (i >= 0 && array[i] > key) {
                array[i + 1] = array[i];
                i--;
            }
            array[i + 1] = key;
            for(int k=0;k<array.length;k++){
              if(k<array.length-1){
                System.out.print(array[k]);
                System.out.print(" ");
              }else{
                System.out.println(array[k]);
              }
            }
        }
  } Scanner scan=new Scanner(System.in); scan new Scanner(System.in) int n=Integer.parseInt(scan.next()); n Integer.parseInt(scan.next()) Integer.parseInt Integer scan.next() scan.next scan int[] array=new int[n]; array new int[n] n for(int i=0;i<array.length;i++){
      array[i]=Integer.parseInt(scan.next());
    } int i=0; int i=0; i 0 i<array.length i array.length array array.length i++ i++ i {
      array[i]=Integer.parseInt(scan.next());
    } {
      array[i]=Integer.parseInt(scan.next());
    } array[i]=Integer.parseInt(scan.next()) array[i] array i Integer.parseInt(scan.next()) Integer.parseInt Integer scan.next() scan.next scan for(int k=0;k<array.length;k++){
      if(k<array.length-1){
        System.out.print(array[k]);
        System.out.print(" ");
      }else{
        System.out.println(array[k]);
      }
    } int k=0; int k=0; k 0 k<array.length k array.length array array.length k++ k++ k {
      if(k<array.length-1){
        System.out.print(array[k]);
        System.out.print(" ");
      }else{
        System.out.println(array[k]);
      }
    } {
      if(k<array.length-1){
        System.out.print(array[k]);
        System.out.print(" ");
      }else{
        System.out.println(array[k]);
      }
    } if(k<array.length-1){
        System.out.print(array[k]);
        System.out.print(" ");
      }else{
        System.out.println(array[k]);
      } k<array.length-1 k array.length-1 array.length array array.length 1 {
        System.out.print(array[k]);
        System.out.print(" ");
      } System.out.print(array[k]) System.out.print System.out System System.out array[k] array k System.out.print(" ") System.out.print System.out System System.out " " {
        System.out.println(array[k]);
      } System.out.println(array[k]) System.out.println System.out System System.out array[k] array k for (int j = 1; j < array.length; j++) {
            int key = array[j];
            int i = j - 1;
            while (i >= 0 && array[i] > key) {
                array[i + 1] = array[i];
                i--;
            }
            array[i + 1] = key;
            for(int k=0;k<array.length;k++){
              if(k<array.length-1){
                System.out.print(array[k]);
                System.out.print(" ");
              }else{
                System.out.println(array[k]);
              }
            }
        } int j = 1; int j = 1; j 1 j < array.length j array.length array array.length j++ j++ j {
            int key = array[j];
            int i = j - 1;
            while (i >= 0 && array[i] > key) {
                array[i + 1] = array[i];
                i--;
            }
            array[i + 1] = key;
            for(int k=0;k<array.length;k++){
              if(k<array.length-1){
                System.out.print(array[k]);
                System.out.print(" ");
              }else{
                System.out.println(array[k]);
              }
            }
        } {
            int key = array[j];
            int i = j - 1;
            while (i >= 0 && array[i] > key) {
                array[i + 1] = array[i];
                i--;
            }
            array[i + 1] = key;
            for(int k=0;k<array.length;k++){
              if(k<array.length-1){
                System.out.print(array[k]);
                System.out.print(" ");
              }else{
                System.out.println(array[k]);
              }
            }
        } int key = array[j]; key array[j] array j int i = j - 1; i j - 1 j 1 while (i >= 0 && array[i] > key) {
                array[i + 1] = array[i];
                i--;
            } i >= 0 && array[i] > key i >= 0 i 0 array[i] > key array[i] array i key {
                array[i + 1] = array[i];
                i--;
            } array[i + 1] = array[i] array[i + 1] array i + 1 i 1 array[i] array i i-- i array[i + 1] = key array[i + 1] array i + 1 i 1 key for(int k=0;k<array.length;k++){
              if(k<array.length-1){
                System.out.print(array[k]);
                System.out.print(" ");
              }else{
                System.out.println(array[k]);
              }
            } int k=0; int k=0; k 0 k<array.length k array.length array array.length k++ k++ k {
              if(k<array.length-1){
                System.out.print(array[k]);
                System.out.print(" ");
              }else{
                System.out.println(array[k]);
              }
            } {
              if(k<array.length-1){
                System.out.print(array[k]);
                System.out.print(" ");
              }else{
                System.out.println(array[k]);
              }
            } if(k<array.length-1){
                System.out.print(array[k]);
                System.out.print(" ");
              }else{
                System.out.println(array[k]);
              } k<array.length-1 k array.length-1 array.length array array.length 1 {
                System.out.print(array[k]);
                System.out.print(" ");
              } System.out.print(array[k]) System.out.print System.out System System.out array[k] array k System.out.print(" ") System.out.print System.out System System.out " " {
                System.out.println(array[k]);
              } System.out.println(array[k]) System.out.println System.out System System.out array[k] array k String[] args args
import java.io.*;
import java.util.*;

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

    Scanner scan=new Scanner(System.in);
    int n=Integer.parseInt(scan.next());
    int[] array=new int[n];
    for(int i=0;i<array.length;i++){
      array[i]=Integer.parseInt(scan.next());
    }

    for(int k=0;k<array.length;k++){
      if(k<array.length-1){
        System.out.print(array[k]);
        System.out.print(" ");
      }else{
        System.out.println(array[k]);
      }
    }

    //ソート
    for (int j = 1; j < array.length; j++) {
            int key = array[j];
            int i = j - 1;
            while (i >= 0 && array[i] > key) {
                array[i + 1] = array[i];
                i--;
            }
            array[i + 1] = key;
            for(int k=0;k<array.length;k++){
              if(k<array.length-1){
                System.out.print(array[k]);
                System.out.print(" ");
              }else{
                System.out.println(array[k]);
              }
            }
        }
  }
}

