def insertion_sort(array, debug=False):
    """ AOJ??¬??¶?????¬???
    http://judge.u-aizu.ac.jp/onlinejudge/commentary.jsp?id=ALDS1_1_A

    :param array: ?????????????±??????????
    :param debug: ??????????????????????????????????????????????????°
    :return: ?????????????????????
    """
    for i in range(0, len(array)):  # i????¬??????????????????????????????????
        v = array[i]  # ?????¨?????\???????????¨????????????????????????????????´???
        j = i - 1
        while j >= 0 and array[j] > v:
            array[j + 1] = array[j]
            j -= 1
        array[j + 1] = v
        if debug is True:
            print(' '.join(map(str, array)))
    return array


if __name__ == '__main__':
    # ??????????????¬?????¨
    # start_time = datetime.now()
    # print('>>> {0}'.format(start_time))

    # ??????????????\???
    num = int(input())
    data = [int(x) for x in input().split(' ')]
    # data = [5, 2, 4, 6, 1, 3]

    # ?????\??????????????????
    result = insertion_sort(data, debug=True)

    # ???????????????
    # print('result: {0}'.format(result)) def insertion_sort(array, debug=False):
    """ AOJ??¬??¶?????¬???
    http://judge.u-aizu.ac.jp/onlinejudge/commentary.jsp?id=ALDS1_1_A

    :param array: ?????????????±??????????
    :param debug: ??????????????????????????????????????????????????°
    :return: ?????????????????????
    """
    for i in range(0, len(array)):  # i????¬??????????????????????????????????
        v = array[i]  # ?????¨?????\???????????¨????????????????????????????????´???
        j = i - 1
        while j >= 0 and array[j] > v:
            array[j + 1] = array[j]
            j -= 1
        array[j + 1] = v
        if debug is True:
            print(' '.join(map(str, array)))
    return array insertion_sort """ AOJ??¬??¶?????¬???
    http://judge.u-aizu.ac.jp/onlinejudge/commentary.jsp?id=ALDS1_1_A

    :param array: ?????????????±??????????
    :param debug: ??????????????????????????????????????????????????°
    :return: ?????????????????????
    """ for i in range(0, len(array)):  # i????¬??????????????????????????????????
        v = array[i]  # ?????¨?????\???????????¨????????????????????????????????´???
        j = i - 1
        while j >= 0 and array[j] > v:
            array[j + 1] = array[j]
            j -= 1
        array[j + 1] = v
        if debug is True:
            print(' '.join(map(str, array)))
     i range(0, len(array)) range 0 len(array) len array v = array[i] v array[i] array i j = i - 1 j i - 1 i 1 while j >= 0 and array[j] > v:
            array[j + 1] = array[j]
            j -= 1
         j >= 0 and array[j] > v j >= 0 j 0 array[j] > v array[j] array j v array[j + 1] = array[j] array[j + 1] array j + 1 j 1 array[j] array j j -= 1 j 1 array[j + 1] = v array[j + 1] array j + 1 j 1 v if debug is True:
            print(' '.join(map(str, array)))
     debug is True debug True print(' '.join(map(str, array))) print ' '.join(map(str, array)) ' '.join ' ' join map(str, array) map str array return array array array array debug=False debug False if __name__ == '__main__':
    # ??????????????¬?????¨
    # start_time = datetime.now()
    # print('>>> {0}'.format(start_time))

    # ??????????????\???
    num = int(input())
    data = [int(x) for x in input().split(' ')]
    # data = [5, 2, 4, 6, 1, 3]

    # ?????\??????????????????
    result = insertion_sort(data, debug=True)

    # ???????????????
    # print('result: {0}'.format(result)) __name__ == '__main__' __name__ '__main__' num = int(input()) num int(input()) int input() input int(x) for x in input().split(' ') for x in input().split(' ') x input().split(' ') ().split () input split ' ' for x in input().split(' ') int(x) int x data = [int(x) for x in input().split(' ')] data [int(x) for x in input().split(' ')] result = insertion_sort(data, debug=True) result insertion_sort(data, debug=True) insertion_sort data debug=True debug True data = [int(x) for x in input().split(' ')] [int(x) for x in input().split(' ')] data result = insertion_sort(data, debug=True) insertion_sort(data, debug=True) result num = int(input()) int(input()) num def insertion_sort(array, debug=False):
    """ AOJ??¬??¶?????¬???
    http://judge.u-aizu.ac.jp/onlinejudge/commentary.jsp?id=ALDS1_1_A

    :param array: ?????????????±??????????
    :param debug: ??????????????????????????????????????????????????°
    :return: ?????????????????????
    """
    for i in range(0, len(array)):  # i????¬??????????????????????????????????
        v = array[i]  # ?????¨?????\???????????¨????????????????????????????????´???
        j = i - 1
        while j >= 0 and array[j] > v:
            array[j + 1] = array[j]
            j -= 1
        array[j + 1] = v
        if debug is True:
            print(' '.join(map(str, array)))
    return array def insertion_sort(array, debug=False):
    """ AOJ??¬??¶?????¬???
    http://judge.u-aizu.ac.jp/onlinejudge/commentary.jsp?id=ALDS1_1_A

    :param array: ?????????????±??????????
    :param debug: ??????????????????????????????????????????????????°
    :return: ?????????????????????
    """
    for i in range(0, len(array)):  # i????¬??????????????????????????????????
        v = array[i]  # ?????¨?????\???????????¨????????????????????????????????´???
        j = i - 1
        while j >= 0 and array[j] > v:
            array[j + 1] = array[j]
            j -= 1
        array[j + 1] = v
        if debug is True:
            print(' '.join(map(str, array)))
    return array insertion_sort
def insertion_sort(array, debug=False):
    """ AOJ??¬??¶?????¬???
    http://judge.u-aizu.ac.jp/onlinejudge/commentary.jsp?id=ALDS1_1_A

    :param array: ?????????????±??????????
    :param debug: ??????????????????????????????????????????????????°
    :return: ?????????????????????
    """
    for i in range(0, len(array)):  # i????¬??????????????????????????????????
        v = array[i]  # ?????¨?????\???????????¨????????????????????????????????´???
        j = i - 1
        while j >= 0 and array[j] > v:
            array[j + 1] = array[j]
            j -= 1
        array[j + 1] = v
        if debug is True:
            print(' '.join(map(str, array)))
    return array


if __name__ == '__main__':
    # ??????????????¬?????¨
    # start_time = datetime.now()
    # print('>>> {0}'.format(start_time))

    # ??????????????\???
    num = int(input())
    data = [int(x) for x in input().split(' ')]
    # data = [5, 2, 4, 6, 1, 3]

    # ?????\??????????????????
    result = insertion_sort(data, debug=True)

    # ???????????????
    # print('result: {0}'.format(result))