using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;


namespace AizuOnlineJudge
{
    /// <summary>
    /// メインクラス　問題解答
    /// </summary>
    public class Program
    {
        /// <summary>
        /// 実行関数
        /// </summary>
        /// <param name="args"></param>
        public static void Main(string[] args)
        {
            new Sort().Anser();
        }
    }

    /// <summary>
    /// FizzBuzz出力クラス
    /// </summary>
    public class Sort
    {
        /// <summary>
        /// 入出力担当クラス　今回は答え出力用
        /// </summary>
        ConsoleInput Input = new ConsoleInput(Console.In, ' ');

        /// <summary>
        /// ソート答え
        /// </summary>
        public void Anser()
        {
            List<int> elementList = GetElementList();

            for (int i = 0; i < elementList.Count; i++)
            {
                int targetValue = elementList[i];
                int r = i - 1;

                while (r >= 0 && elementList[r] > targetValue)
                {
                    elementList[r + 1] = elementList[r];
                    elementList[r] = targetValue;
                    r--;
                }

                Input.OutPut(elementList, ' ');
            }
        }

        /// <summary>
        /// ソートするべき要素をListに格納して返す
        /// </summary>
        /// <returns>Loop回数</returns>
        public List<int> GetElementList()
        {
            var input = new ConsoleInput(Console.In, ' ');

            var elementList = new List<int>();
            elementList.AddRange(input.ReadIntArray(Convert.ToInt32(Console.ReadLine())));

            return elementList;
        }
    }

    /// <summary>
    /// 標準入出力担当クラス
    /// </summary>
    public class ConsoleInput
    {
        /// <summary>
        /// ストリームからテキストを読み込む
        /// </summary>
        private readonly System.IO.TextReader Stream;

        /// <summary>
        /// 区分け文字
        /// </summary>
        private char Separator = ' ';

        /// <summary>
        /// 読み取った入力値を格納する
        /// </summary>
        private Queue<string> InputStream;

        /// <summary>
        /// コンストラクタ
        /// </summary>
        /// <param name="Stream">使用するテキストリーダー</param>
        /// <param name="Separator">区分け文字</param>
        public ConsoleInput(System.IO.TextReader Stream, char Separator = ' ')
        {
            this.Separator = Separator;
            this.Stream = Stream;
            InputStream = new Queue<string>();
        }

        /// <summary>
        /// 入力値読込み
        /// </summary>
        public string Read
        {
            get
            {
                if (InputStream.Count != 0)
                {
                    return InputStream.Dequeue();
                }

                string[] splitStrs = Stream.ReadLine().Split(Separator);

                for (int i = 0; i < splitStrs.Length; ++i)
                {
                    InputStream.Enqueue(splitStrs[i]);
                }

                return InputStream.Dequeue();
            }
        }

        public string ReadLine { get { return Stream.ReadLine(); } }

        public int ReadInt { get { return int.Parse(Read); } }

        public long ReadLong { get { return long.Parse(Read); } }

        public double ReadDouble { get { return double.Parse(Read); } }

        public string[] ReadStrArray(long N)
        {
            var inputStrArray = new string[N];
            for (long i = 0; i < N; ++i)
            {
                inputStrArray[i] = Read;
            }

            return inputStrArray;
        }

        public int[] ReadIntArray(long N)
        {
            var inputIntArray = new int[N];
            for (long i = 0; i < N; ++i)
            {
                inputIntArray[i] = ReadInt;
            }

            return inputIntArray;
        }

        public long[] ReadLongArray(long N)
        {
            var inputLongArray = new long[N];
            for (long i = 0; i < N; ++i)
            {
                inputLongArray[i] = ReadLong;
            }

            return inputLongArray;
        }

        /// <summary>
        /// Separator区切りでAnserListの要素を一行に出力する
        /// </summary>
        /// <param name="AnserList"></param>
        /// <param name="Separator"></param>
        public void OutPut(List<int> AnserList, char Separator)
        {
            for (int i = 0; i < AnserList.Count; i++)
            {
                if (i != AnserList.Count - 1)
                    Console.Write(AnserList[i] + " ");
                else
                    Console.Write(AnserList[i]);
            }

            Console.Write("\n");
        }

    }

}


Measured memory_bytes: 16504