logs = list(map(int, input().split()))


def swap(i, j):
    logs[i], logs[j] = logs[j], logs[i]


while logs != [1, 2, 3, 4, 5]:
    for i in range(len(logs) - 1):
        if logs[i] > logs[i + 1]:
            swap(i, i + 1)
            print(' '.join(map(str, logs)))

fd7660fbb9bddbede846ac8a8a925a260c003263
<mask token>

<mask token>


def swap(i, j):
    logs[i], logs[j] = logs[j], logs[i]


<mask token>

<mask token>


def swap(i, j):
    logs[i], logs[j] = logs[j], logs[i]


while logs != [1, 2, 3, 4, 5]:
    for i in range(len(logs) - 1):
        if logs[i] > logs[i + 1]:
            swap(i, i + 1)
            print(' '.join(map(str, logs)))

logs = list(map(int, input().split()))


def swap(i, j):
    logs[i], logs[j] = logs[j], logs[i]


while logs != [1, 2, 3, 4, 5]:
    for i in range(len(logs) - 1):
        if logs[i] > logs[i + 1]:
            swap(i, i + 1)
            print(' '.join(map(str, logs)))
