import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] arr = new int[n];
        for (int i = 0; i < n; i++) {
            arr[i] = Integer.parseInt(sc.next());
        }
        print(arr);
        for (int i = 1; i < n; i++) {
            int v = arr[i];
            int j = i - 1;
            while (j >= 0 && arr[j] > v) {
                arr[j+1] = arr[j];
                j --;
            }
            arr[j+1] = v;
            print(arr);
        }
    }

    private static void print(int[] arr) {
        for (int k = 0; k < arr.length; k++) {
            if (k != arr.length-1) {
                System.out.print(arr[k] + " ");
            } else {
                System.out.print(arr[k]);
            }
        }
        System.out.println();
    }
}
 import java.util.Arrays; Arrays java.util import java.util.Scanner; Scanner java.util public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] arr = new int[n];
        for (int i = 0; i < n; i++) {
            arr[i] = Integer.parseInt(sc.next());
        }
        print(arr);
        for (int i = 1; i < n; i++) {
            int v = arr[i];
            int j = i - 1;
            while (j >= 0 && arr[j] > v) {
                arr[j+1] = arr[j];
                j --;
            }
            arr[j+1] = v;
            print(arr);
        }
    }

    private static void print(int[] arr) {
        for (int k = 0; k < arr.length; k++) {
            if (k != arr.length-1) {
                System.out.print(arr[k] + " ");
            } else {
                System.out.print(arr[k]);
            }
        }
        System.out.println();
    }
} Main public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] arr = new int[n];
        for (int i = 0; i < n; i++) {
            arr[i] = Integer.parseInt(sc.next());
        }
        print(arr);
        for (int i = 1; i < n; i++) {
            int v = arr[i];
            int j = i - 1;
            while (j >= 0 && arr[j] > v) {
                arr[j+1] = arr[j];
                j --;
            }
            arr[j+1] = v;
            print(arr);
        }
    } main {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] arr = new int[n];
        for (int i = 0; i < n; i++) {
            arr[i] = Integer.parseInt(sc.next());
        }
        print(arr);
        for (int i = 1; i < n; i++) {
            int v = arr[i];
            int j = i - 1;
            while (j >= 0 && arr[j] > v) {
                arr[j+1] = arr[j];
                j --;
            }
            arr[j+1] = v;
            print(arr);
        }
    } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int[] arr = new int[n]; arr new int[n] n for (int i = 0; i < n; i++) {
            arr[i] = Integer.parseInt(sc.next());
        } int i = 0; int i = 0; i 0 i < n i n i++ i++ i {
            arr[i] = Integer.parseInt(sc.next());
        } {
            arr[i] = Integer.parseInt(sc.next());
        } arr[i] = Integer.parseInt(sc.next()) arr[i] arr i Integer.parseInt(sc.next()) Integer.parseInt Integer sc.next() sc.next sc print(arr) print arr for (int i = 1; i < n; i++) {
            int v = arr[i];
            int j = i - 1;
            while (j >= 0 && arr[j] > v) {
                arr[j+1] = arr[j];
                j --;
            }
            arr[j+1] = v;
            print(arr);
        } int i = 1; int i = 1; i 1 i < n i n i++ i++ i {
            int v = arr[i];
            int j = i - 1;
            while (j >= 0 && arr[j] > v) {
                arr[j+1] = arr[j];
                j --;
            }
            arr[j+1] = v;
            print(arr);
        } {
            int v = arr[i];
            int j = i - 1;
            while (j >= 0 && arr[j] > v) {
                arr[j+1] = arr[j];
                j --;
            }
            arr[j+1] = v;
            print(arr);
        } int v = arr[i]; v arr[i] arr i int j = i - 1; j i - 1 i 1 while (j >= 0 && arr[j] > v) {
                arr[j+1] = arr[j];
                j --;
            } j >= 0 && arr[j] > v j >= 0 j 0 arr[j] > v arr[j] arr j v {
                arr[j+1] = arr[j];
                j --;
            } arr[j+1] = arr[j] arr[j+1] arr j+1 j 1 arr[j] arr j j -- j arr[j+1] = v arr[j+1] arr j+1 j 1 v print(arr) print arr String[] args args private static void print(int[] arr) {
        for (int k = 0; k < arr.length; k++) {
            if (k != arr.length-1) {
                System.out.print(arr[k] + " ");
            } else {
                System.out.print(arr[k]);
            }
        }
        System.out.println();
    } print {
        for (int k = 0; k < arr.length; k++) {
            if (k != arr.length-1) {
                System.out.print(arr[k] + " ");
            } else {
                System.out.print(arr[k]);
            }
        }
        System.out.println();
    } for (int k = 0; k < arr.length; k++) {
            if (k != arr.length-1) {
                System.out.print(arr[k] + " ");
            } else {
                System.out.print(arr[k]);
            }
        } int k = 0; int k = 0; k 0 k < arr.length k arr.length arr arr.length k++ k++ k {
            if (k != arr.length-1) {
                System.out.print(arr[k] + " ");
            } else {
                System.out.print(arr[k]);
            }
        } {
            if (k != arr.length-1) {
                System.out.print(arr[k] + " ");
            } else {
                System.out.print(arr[k]);
            }
        } if (k != arr.length-1) {
                System.out.print(arr[k] + " ");
            } else {
                System.out.print(arr[k]);
            } k != arr.length-1 k arr.length-1 arr.length arr arr.length 1 {
                System.out.print(arr[k] + " ");
            } System.out.print(arr[k] + " ") System.out.print System.out System System.out arr[k] + " " arr[k] arr k " " {
                System.out.print(arr[k]);
            } System.out.print(arr[k]) System.out.print System.out System System.out arr[k] arr k System.out.println() System.out.println System.out System System.out int[] arr arr public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] arr = new int[n];
        for (int i = 0; i < n; i++) {
            arr[i] = Integer.parseInt(sc.next());
        }
        print(arr);
        for (int i = 1; i < n; i++) {
            int v = arr[i];
            int j = i - 1;
            while (j >= 0 && arr[j] > v) {
                arr[j+1] = arr[j];
                j --;
            }
            arr[j+1] = v;
            print(arr);
        }
    }

    private static void print(int[] arr) {
        for (int k = 0; k < arr.length; k++) {
            if (k != arr.length-1) {
                System.out.print(arr[k] + " ");
            } else {
                System.out.print(arr[k]);
            }
        }
        System.out.println();
    }
} public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] arr = new int[n];
        for (int i = 0; i < n; i++) {
            arr[i] = Integer.parseInt(sc.next());
        }
        print(arr);
        for (int i = 1; i < n; i++) {
            int v = arr[i];
            int j = i - 1;
            while (j >= 0 && arr[j] > v) {
                arr[j+1] = arr[j];
                j --;
            }
            arr[j+1] = v;
            print(arr);
        }
    }

    private static void print(int[] arr) {
        for (int k = 0; k < arr.length; k++) {
            if (k != arr.length-1) {
                System.out.print(arr[k] + " ");
            } else {
                System.out.print(arr[k]);
            }
        }
        System.out.println();
    }
} Main
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] arr = new int[n];
        for (int i = 0; i < n; i++) {
            arr[i] = Integer.parseInt(sc.next());
        }
        print(arr);
        for (int i = 1; i < n; i++) {
            int v = arr[i];
            int j = i - 1;
            while (j >= 0 && arr[j] > v) {
                arr[j+1] = arr[j];
                j --;
            }
            arr[j+1] = v;
            print(arr);
        }
    }

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

