Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
import copy


def check_nn(b_):
    n_ = len(b_)
    # print(b_)

    if b_ == [1]:
        return [1]

    nn = np.zeros(n_)
    for ii in range(n_):
        if b_[ii] == ii+1:
            nn[ii] = 1

    tsum = int(sum(nn))

    if tsum == 0:
        return -1

    # if n_ == 1 and tsum == 1:
    #     ans_ = [1]

    tind = np.where(nn == 1)
    # print(tind)
    for ii in range(tsum):
        # tp = b_.pop[tind[ii]]
        tempb = copy.deepcopy(b_)
        # print(tind[0][ii])
        tp = tempb.pop(tind[0][ii])
        ans_ = check_nn(tempb)
        if ans_ != -1:
            # ans_.insert(0, tp)
            ans_.append(tp)
            return ans_

    return -1


n = input().rstrip().split(' ')
b = list(map(int, input().rstrip().split(' ')))
# ans = list()

# print(type(b))

ans = check_nn(b)

# print(ans)

if ans == -1:
    print(ans)
else:
    na = len(ans)
    for ii in range(na):
        print(ans[ii])



Fixed submission:
import sys

n = int(input())
b = list(map(int, input().rstrip().split(' ')))

ans = list()

for ii in reversed(range(n)):
    for jj in reversed(range(ii+1)):
        if b[jj] == jj + 1:
            ans.append(b.pop(jj))
            # print(ans)
            break

if len(b) != 0:
    print(-1)
    sys.exit()

for ii in reversed(range(n)):
    print(ans[ii])

Buggy python submission (verdict: Runtime Error):
# 実行時の引数の入力：https://qiita.com/orange_u/items/3f0fb6044fd5ee2c3a37

import sys

args = sys.argv

num_len = int(args[1])
a = []
b = []
N = 100
# b = [1,2,1]
for i in range(2, 2+num_len):
    b.append(int(args[i]))
print(b)



# for i in range(len(b)):
for i in range(num_len):
    # try:
    #     # print(i)
    #     a.insert(b[i], b[i])
    #     print(a)
    # except:
    #     print(-1)

    if a == b:
        # print(i)
        a.insert(b[i], b[i])
        print(a)
    else:
        print(-1)




Fixed submission:
# 実行時の引数の入力：https://qiita.com/orange_u/items/3f0fb6044fd5ee2c3a37

# ***.py a b c形式の引数使用時
# import sys
#
# args = sys.argv
#
# num_len = int(args[1])
# a = []
# b = []
# N = 100
# # b = [1,2,1]
# for i in range(2, 2+num_len):
#     b.append(int(args[i]))
# print(b)

a = []
# print('input:')
num_len = int(input())
b = list(map(int, input().split()))
# print('--'*len(b))
# print('output:')
# print(b)
N = 100



# for i in range(len(b)):
for i in range(num_len):
    # try:
    #     # print(i)
    #     a.insert(b[i], b[i])
    #     print(a)
    # except:
    #     print(-1)

    if b[i]-1 <= len(a):
        # print(i)
        a.insert(b[i]-1, b[i])
        # print(a)
        flag = True
    else:
        flag = False
        break


if flag:
    for i in a:
        print(i)
else:
    print(-1)

Buggy python submission (verdict: Runtime Error):
# 実行時の引数の入力：https://qiita.com/orange_u/items/3f0fb6044fd5ee2c3a37

import sys

args = sys.argv

num_len = int(args[1])
a = []
b = []
N = 100
# b = [1,2,1]
for i in range(2, 2+num_len):
    b.append(int(args[i]))
print(b)



# for i in range(len(b)):
for i in range(num_len):
    # try:
    #     # print(i)
    #     a.insert(b[i], b[i])
    #     print(a)
    # except:
    #     print(-1)

    if a == b:
        # print(i)
        a.insert(b[i], b[i])
        print(a)
    else:
        print(-1)




Fixed submission:
# 実行時の引数の入力：https://qiita.com/orange_u/items/3f0fb6044fd5ee2c3a37

# ***.py a b c形式の引数使用時
# import sys
#
# args = sys.argv
#
# num_len = int(args[1])
# a = []
# b = []
# N = 100
# # b = [1,2,1]
# for i in range(2, 2+num_len):
#     b.append(int(args[i]))
# print(b)

a = []
# print('input:')
num_len = int(input())
b = list(map(int, input().split()))
# print('--'*len(b))
# print('output:')
# print(b)
N = 100



# for i in range(len(b)):
for i in range(num_len):
    # try:
    #     # print(i)
    #     a.insert(b[i], b[i])
    #     print(a)
    # except:
    #     print(-1)

    if b[i]-1 <= len(a):
        # print(i)
        a.insert(b[i]-1, b[i])
        # print(a)
        flag = True
    else:
        flag = False
        break


if flag:
    for i in a:
        print(i)
else:
    print(-1)