import sys

ERROR_INPUT = 'input is invalid'


def main():
    n = get_length()
    arr = get_array(length=n)
    print(*arr)

    insetionSort(li=arr, length=n)
    return 0


def get_length():
    n = int(input())
    if n < 0 or n > 100:
        print(ERROR_INPUT)
        sys.exit(1)
    else:
        return n


def get_array(length):
    nums = input().split(' ')
    return [str2int(string=n) for n in nums]


def str2int(string):
    n = int(string)
    if n < 0 or n > 1000:
        print(ERROR_INPUT)
        sys.exit(1)
    else:
        return n


def insetionSort(li, length):
    for i in range(1, length):
        v = li[i]
        j = i - 1
        while j >= 0 and li[j] > v:
            li[j + 1] = li[j]
            j -= 1

        li[j + 1] = v
        print(*li)


main() import sys sys ERROR_INPUT = 'input is invalid' ERROR_INPUT 'input is invalid' def main():
    n = get_length()
    arr = get_array(length=n)
    print(*arr)

    insetionSort(li=arr, length=n)
    return 0 main n = get_length() n get_length() get_length arr = get_array(length=n) arr get_array(length=n) get_array length=n length n print(*arr) print *arr arr insetionSort(li=arr, length=n) insetionSort li=arr li arr length=n length n return 0 0 def get_length():
    n = int(input())
    if n < 0 or n > 100:
        print(ERROR_INPUT)
        sys.exit(1)
    else:
        return n get_length n = int(input()) n int(input()) int input() input if n < 0 or n > 100:
        print(ERROR_INPUT)
        sys.exit(1)
    else:
        return n n < 0 or n > 100 n < 0 n 0 n > 100 n 100 print(ERROR_INPUT) print ERROR_INPUT sys.exit(1) sys.exit sys exit 1 return n n def get_array(length):
    nums = input().split(' ')
    return [str2int(string=n) for n in nums] get_array nums = input().split(' ') nums input().split(' ') ().split () input split ' ' str2int(string=n) for n in nums for n in nums n nums for n in nums str2int(string=n) str2int string=n string n return [str2int(string=n) for n in nums] [str2int(string=n) for n in nums] length length def str2int(string):
    n = int(string)
    if n < 0 or n > 1000:
        print(ERROR_INPUT)
        sys.exit(1)
    else:
        return n str2int n = int(string) n int(string) int string if n < 0 or n > 1000:
        print(ERROR_INPUT)
        sys.exit(1)
    else:
        return n n < 0 or n > 1000 n < 0 n 0 n > 1000 n 1000 print(ERROR_INPUT) print ERROR_INPUT sys.exit(1) sys.exit sys exit 1 return n n string string def insetionSort(li, length):
    for i in range(1, length):
        v = li[i]
        j = i - 1
        while j >= 0 and li[j] > v:
            li[j + 1] = li[j]
            j -= 1

        li[j + 1] = v
        print(*li) insetionSort for i in range(1, length):
        v = li[i]
        j = i - 1
        while j >= 0 and li[j] > v:
            li[j + 1] = li[j]
            j -= 1

        li[j + 1] = v
        print(*li) i range(1, length) range 1 length v = li[i] v li[i] li i j = i - 1 j i - 1 i 1 while j >= 0 and li[j] > v:
            li[j + 1] = li[j]
            j -= 1

         j >= 0 and li[j] > v j >= 0 j 0 li[j] > v li[j] li j v li[j + 1] = li[j] li[j + 1] li j + 1 j 1 li[j] li j j -= 1 j 1 li[j + 1] = v li[j + 1] li j + 1 j 1 v print(*li) print *li li li li length length main() main def str2int(string):
    n = int(string)
    if n < 0 or n > 1000:
        print(ERROR_INPUT)
        sys.exit(1)
    else:
        return n def str2int(string):
    n = int(string)
    if n < 0 or n > 1000:
        print(ERROR_INPUT)
        sys.exit(1)
    else:
        return n str2int def insetionSort(li, length):
    for i in range(1, length):
        v = li[i]
        j = i - 1
        while j >= 0 and li[j] > v:
            li[j + 1] = li[j]
            j -= 1

        li[j + 1] = v
        print(*li) def insetionSort(li, length):
    for i in range(1, length):
        v = li[i]
        j = i - 1
        while j >= 0 and li[j] > v:
            li[j + 1] = li[j]
            j -= 1

        li[j + 1] = v
        print(*li) insetionSort def get_length():
    n = int(input())
    if n < 0 or n > 100:
        print(ERROR_INPUT)
        sys.exit(1)
    else:
        return n def get_length():
    n = int(input())
    if n < 0 or n > 100:
        print(ERROR_INPUT)
        sys.exit(1)
    else:
        return n get_length def get_array(length):
    nums = input().split(' ')
    return [str2int(string=n) for n in nums] def get_array(length):
    nums = input().split(' ')
    return [str2int(string=n) for n in nums] get_array ERROR_INPUT = 'input is invalid' 'input is invalid' ERROR_INPUT def main():
    n = get_length()
    arr = get_array(length=n)
    print(*arr)

    insetionSort(li=arr, length=n)
    return 0 def main():
    n = get_length()
    arr = get_array(length=n)
    print(*arr)

    insetionSort(li=arr, length=n)
    return 0 main
import sys

ERROR_INPUT = 'input is invalid'


def main():
    n = get_length()
    arr = get_array(length=n)
    print(*arr)

    insetionSort(li=arr, length=n)
    return 0


def get_length():
    n = int(input())
    if n < 0 or n > 100:
        print(ERROR_INPUT)
        sys.exit(1)
    else:
        return n


def get_array(length):
    nums = input().split(' ')
    return [str2int(string=n) for n in nums]


def str2int(string):
    n = int(string)
    if n < 0 or n > 1000:
        print(ERROR_INPUT)
        sys.exit(1)
    else:
        return n


def insetionSort(li, length):
    for i in range(1, length):
        v = li[i]
        j = i - 1
        while j >= 0 and li[j] > v:
            li[j + 1] = li[j]
            j -= 1

        li[j + 1] = v
        print(*li)


main()