# -*- coding: utf-8 -*-


def insertion_sort(seq, l):
    print(' '.join([str(n) for n in seq]))
    for i, v in enumerate(seq[1:], start=1):
        left = i - 1
        while left >= 0 and seq[left] > v:
            seq[left], seq[left+1] = seq[left+1], seq[left]
            left -= 1
        print(' '.join([str(n) for n in seq]))


def to_int(v):
    return int(v)


def to_seq(v):
    return [int(c) for c in v.split()]


if __name__ == '__main__':
    l = to_int(input())
    seq = to_seq(input())

    insertion_sort(seq, l) def insertion_sort(seq, l):
    print(' '.join([str(n) for n in seq]))
    for i, v in enumerate(seq[1:], start=1):
        left = i - 1
        while left >= 0 and seq[left] > v:
            seq[left], seq[left+1] = seq[left+1], seq[left]
            left -= 1
        print(' '.join([str(n) for n in seq])) insertion_sort str(n) for n in seq for n in seq n seq for n in seq str(n) str n print(' '.join([str(n) for n in seq])) print ' '.join([str(n) for n in seq]) ' '.join ' ' join [str(n) for n in seq] for i, v in enumerate(seq[1:], start=1):
        left = i - 1
        while left >= 0 and seq[left] > v:
            seq[left], seq[left+1] = seq[left+1], seq[left]
            left -= 1
        print(' '.join([str(n) for n in seq])) i v enumerate(seq[1:], start=1) enumerate seq[1:] seq 1: 1 start=1 start 1 left = i - 1 left i - 1 i 1 while left >= 0 and seq[left] > v:
            seq[left], seq[left+1] = seq[left+1], seq[left]
            left -= 1
         left >= 0 and seq[left] > v left >= 0 left 0 seq[left] > v seq[left] seq left v seq[left], seq[left+1] = seq[left+1], seq[left] seq[left] seq left seq[left+1] seq left+1 left 1 seq[left+1] seq left+1 left 1 seq[left] seq left left -= 1 left 1 str(n) for n in seq for n in seq n seq for n in seq str(n) str n print(' '.join([str(n) for n in seq])) print ' '.join([str(n) for n in seq]) ' '.join ' ' join [str(n) for n in seq] seq seq l l def to_int(v):
    return int(v) to_int return int(v) int(v) int v v v def to_seq(v):
    return [int(c) for c in v.split()] to_seq int(c) for c in v.split() for c in v.split() c v.split() v.split v split for c in v.split() int(c) int c return [int(c) for c in v.split()] [int(c) for c in v.split()] v v if __name__ == '__main__':
    l = to_int(input())
    seq = to_seq(input())

    insertion_sort(seq, l) __name__ == '__main__' __name__ '__main__' l = to_int(input()) l to_int(input()) to_int input() input seq = to_seq(input()) seq to_seq(input()) to_seq input() input insertion_sort(seq, l) insertion_sort seq l def to_seq(v):
    return [int(c) for c in v.split()] def to_seq(v):
    return [int(c) for c in v.split()] to_seq def insertion_sort(seq, l):
    print(' '.join([str(n) for n in seq]))
    for i, v in enumerate(seq[1:], start=1):
        left = i - 1
        while left >= 0 and seq[left] > v:
            seq[left], seq[left+1] = seq[left+1], seq[left]
            left -= 1
        print(' '.join([str(n) for n in seq])) def insertion_sort(seq, l):
    print(' '.join([str(n) for n in seq]))
    for i, v in enumerate(seq[1:], start=1):
        left = i - 1
        while left >= 0 and seq[left] > v:
            seq[left], seq[left+1] = seq[left+1], seq[left]
            left -= 1
        print(' '.join([str(n) for n in seq])) insertion_sort l = to_int(input()) to_int(input()) l seq = to_seq(input()) to_seq(input()) seq def to_int(v):
    return int(v) def to_int(v):
    return int(v) to_int
# -*- coding: utf-8 -*-


def insertion_sort(seq, l):
    print(' '.join([str(n) for n in seq]))
    for i, v in enumerate(seq[1:], start=1):
        left = i - 1
        while left >= 0 and seq[left] > v:
            seq[left], seq[left+1] = seq[left+1], seq[left]
            left -= 1
        print(' '.join([str(n) for n in seq]))


def to_int(v):
    return int(v)


def to_seq(v):
    return [int(c) for c in v.split()]


if __name__ == '__main__':
    l = to_int(input())
    seq = to_seq(input())

    insertion_sort(seq, l)