using System;
 
    class Program
    {
        static void Main()
        {
            int n = int.Parse(Console.ReadLine());
            int[] num = Console.ReadLine().Split(" ".ToCharArray(), StringSplitOptions.RemoveEmptyEntries).toIntArray();
 
            Console.WriteLine(string.Join(" ", num.toStringArray()));

            for (int j = 1; j < n; j++)
            {
                int i, key = num[j];
                for (i = j - 1; i >= 0 && num[i] > key; i--)
                {
                    num[i + 1] = num[i];
                }
                num[i + 1] = key;
 
                Console.WriteLine(string.Join(" ", num.toStringArray()));
            }
        }
    }
 
    static class Extensions_intArray
    {
        public static int[] add(this int[] array, int x)
        {
            for (int i = 0; i < array.Length; i++)
            {
                array[i] += x;
            }
            return array;
        }
 
        public static int[] sub(this int[] array, int x)
        {
            for (int i = 0; i < array.Length; i++)
            {
                array[i] -= x;
            }
            return array;
        }
 
        public static int[] add(this int[] array, int[] x)
        {
            for (int i = 0; i < array.Length; i++)
            {
                array[i] += x[i];
            }
            return array;
        }
 
        public static int[] sub(this int[] array, int[] x)
        {
            for (int i = 0; i < array.Length; i++)
            {
                array[i] -= x[i];
            }
            return array;
        }
 
        public static int sum(this int[] array)
        {
            int sum = 0;
            for (int i = 0; i < array.Length; i++)
            {
                sum += array[i];
            }
            return sum;
        }
 
        public static int max(this int[] array)
        {
            int max = int.MinValue;
            for (int i = 0; i < array.Length; i++)
            {
                if (array[i] > max) max = array[i];
            }
 
            return max;
        }
 
        public static int min(this int[] array)
        {
            int min = int.MaxValue;
            for (int i = 0; i < array.Length; i++)
            {
                if (array[i] < min) min = array[i];
            }
 
            return min;
        }
 
        public static int average(this int[] array)
        {
            int average = 0;
            for (int i = 0; i < array.Length; i++)
            {
                average += array[i];
            }
            average /= array.Length;
 
            return average;
        }
 
        public static double[] toDoubleArray(this int[] array)
        {
            return Array.ConvertAll<int, double>(array,
                delegate(int value)
                {
                    return (double)value;
                }
            );
        }
 
        public static string[] toStringArray(this int[] array)
        {
            return Array.ConvertAll<int, string>(array,
                delegate(int value)
                {
                    return value.ToString();
                }
            );
        }
    }
 
    static class Extensions_strArray
    {
        public static int[] toIntArray(this string[] array)
        {
            return Array.ConvertAll<string, int>(array,
                delegate(string value)
                {
                    return int.Parse(value);
                }
            );
        }
 
        public static double[] toDoubleArray(this string[] array)
        {
            return Array.ConvertAll<string, double>(array,
                delegate(string value)
                {
                    return double.Parse(value);
                }
            );
        }
    }

Measured memory_bytes: 5916