Go: package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

var scanner = bufio.NewScanner(os.Stdin)

func nextInt() (int, error) {
	return strconv.Atoi(nextString())
}

func nextString() string {
	scanner.Scan()
	return scanner.Text()
}

func printArr(arr []string) {
	fmt.Println(strings.TrimRight(fmt.Sprintf("%+v", arr)[1:], "]"))
}

func main() {
	scanner.Split(bufio.ScanWords)

	n, _ := nextInt()
	x := make([]int, 2019+1)
	for i := range x {
		x[i] = -1
	}
	for i := 0; i < n; i++ {
		p, _ := nextInt()
		x[p] = i + 1
	}
	m, _ := nextInt()
	a := make([]int, m)
	for i := 0; i < m; i++ {
		a[i], _ = nextInt()
	}

	for i := 0; i < m; i++ {
		ai := a[i]
		//		fmt.Println(a, ai, x[0:10])
		for j := 1; j < 2019; j++ {
			if (x[j] == ai) && (x[j+1] == -1) {
				x[j] = -1
				x[j+1] = ai
				break
			}
		}
	}

	for i := 1; i <= 2019; i++ {
		for j := 1; j <= 2019; j++ {
			if x[j] == i {
				fmt.Println(j)
				break
			}
		}
	}
}

Python: N = int(input())
X = list(map(int, input().split()))
M = int(input())
A = list(map(int, input().split()))

loc = [False] * 2020
for x in X:
    loc[x] = True

for m in range(M):
    now = X[A[m] - 1]
    new = X[A[m] - 1] + 1

    if now == 2019:
        continue

    if not loc[new]:
        X[A[m] - 1] = new
        loc[now] = False
        loc[new] = True

for x in X:
    print(x)

Python: N=int(input())
X=list(map(int,input().split()))
M=int(input())
A=list(map(int,input().split()))

for a in A:
    i=a-1
    mem=X[i]+1
    if mem in X or mem==2020:
        continue
    else:
        X[i]=mem
for x in X:
    print(x)

Python: n=int(input())
x=list(map(int,input().split()))
m=int(input())
a=list(map(int,input().split()))
ax=[]
for j in range(m):
    if x[a[j]-1]+1 not in x and x[a[j]-1]<=2018:
        x[a[j]-1]+=1
for i in x:
    print(i)

Python: N = int(input())
*X, = map(int, input().split())
for i in range(N):
    X[i] -= 1
U = [0]*2019
for i, x in enumerate(X):
    U[x] = 1
M = int(input())
*A, = map(int, input().split())
for a in A:
    x = X[a-1]
    if x < 2018 and not U[x+1]:
        U[x+1] = 1; U[x] = 0
        X[a-1] += 1
for x in X:
    print(x+1)

Python: n = int(input())
x = list(map(int,input().split()))
m = map(int,input())
a = list(map(int,input().split()))


for f in a:
  #print(f,n)
  if x[f-1] < 2019:
    if f == n:
      #print(f,x[f-1])
      x[f-1] += 1
      
    elif x[f-1]+1 != x[f]:
      #print(f,x[f-1])
      x[f-1] += 1

for j in x:
  print(j)

Python: n=int(input())
x=list(map(int,input().split()))

mas=[False]*2022

for i in x:
    mas[i]=True

m=int(input())
a=list(map(int,input().split()))

for i in range(m):
    now=x[a[i]-1]
    if not mas[now+1] and now!=2019:
        mas[now]=False
        mas[now+1]=True
        x[a[i]-1]+=1

for i in range(2020):
    if mas[i]:
        print(i)

Python: import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]

def main():
    n = int(input())
    xx = LI()
    m = int(input())
    aa = LI()
    line = [0] * 2020
    pos = [-1] * (n + 1)
    for a, x in enumerate(xx, 1):
        line[x] = a
        pos[a] = x
    for a in aa:
        if pos[a]==2019 or line[pos[a] + 1] != 0: continue
        line[pos[a]] = 0
        line[pos[a] + 1] = a
        pos[a] += 1
    for x in pos[1:]:
        print(x)

main()

Python: piece_num = int(input())                                # 駒の数
piece_pos_list = [int(s) for s in input().split()]      # 駒の位置リスト
ope_num = int(input())                                  # 操作回数
ope_list = [int(s) for s in input().split()]            # 操作の対象とする駒の番号リスト

MAX_SQUARE = 2019

for i in range(ope_num):
    if (piece_pos_list[ope_list[i] - 1] != MAX_SQUARE)\
       and ((piece_pos_list[ope_list[i] - 1] + 1) not in piece_pos_list):
        # 駒を1つ進める
        piece_pos_list[ope_list[i] - 1] += 1

# 結果を出力
for i in range(piece_num):
    print(piece_pos_list[i])

Python: import sys

input()
x = list(map(int,sys.stdin.readline().split()))
input()
a = tuple(map(int,sys.stdin.readline().split()))
for i in range(len(a)):
    idx = a[i] - 1
    # print(idx, x[idx])
    if x[idx] == 2019:
        pass
    elif idx+1 == len(x):
        x[idx] += 1
    elif x[idx]+1 != x[idx+1]:
        x[idx] += 1

for i in x:
    print(i)

Python: a=int(input())
array2019=[]
array_num=[]
array2019+=map(int,input().split(" ",a-1))
b=int(input())
array_num+=map(int,input().split(" ",b-1))

for n in array_num:
    if array2019[n-1]+1 in array2019 or array2019[n-1]==2019:
        pass
    else:array2019[n-1]+=1

for m in array2019:
    print(m)

Python: #!/usr/bin/python3

import array
from fractions import Fraction
import functools
import itertools
import math
import os
import sys


def main():
    N = read_int()
    X = read_ints()
    M = read_int()
    A = read_ints()
    print(*solve(N, X, M, A), sep='\n')


def solve(N, X, M, A):
    ar = [0] * 2020
    pos = [0] * (N + 1)
    for i, x in enumerate(X):
        ar[x] = i + 1
        pos[i + 1] = x

    for a in A:
        x = pos[a]
        if x != 2019 and ar[x + 1] == 0:
            ar[x] = 0
            ar[x + 1] = a
            pos[a] = x + 1

    return pos[1:]


###############################################################################
# AUXILIARY FUNCTIONS

DEBUG = 'DEBUG' in os.environ


def inp():
    return sys.stdin.readline().rstrip()


def read_int():
    return int(inp())


def read_ints():
    return [int(e) for e in inp().split()]


def dprint(*value, sep=' ', end='\n'):
    if DEBUG:
        print(*value, sep=sep, end=end)


if __name__ == '__main__':
    main()

Python: n=int(input())
X=[]
X=input().split()
X=[int(u) for u in X]
m=int(input())
A=[]
A=input().split()
A=[int(u) for u in A]
for i in range(0,m):
    a=A[i]
    p=0
    for u in range(a,n):
        if (X[a-1]+1)==X[u]:
            p=p+1
    if p==0:
        if X[a-1]!=2019:
            X[a-1]=X[a-1]+1
for i in range(0,n):
    print(X[i])

Python: n = int(input())
x = list(map(int, input().split()))
m = int(input())
a = list(map(int, input().split()))
for i in range(m):
    num = a[i]
    if x[num-1] + 1 in x:
        continue
    elif x[num-1] == 2019:
        continue
    else:
        x[num-1] += 1
for i in range(n):
    print(x[i])

Python: n = int(input())
x = list(map(int, input().split()))
m = int(input())
a = list(map(int, input().split()))
output = [0] * 2019

for i in x:
    output[i - 1] = 1


for k in range(m):
    count = 0
    for l in range(2019):
        if output[l] == 1:
            count += 1


        if count == a[k]:
            if l == 2018:
                break

            if output[l + 1] == 0:
                output[l], output[l + 1] = 0, 1

for i in range(2019):
    if output[i] == 1:
        print(i + 1)

Python: N=int(input())
X=list(map(int,input().split()))
M=int(input())
A=list(map(int,input().split()))
for i in range(M):
    X[A[i]-1]+=1
    if A[i]!=N:
        if X[A[i]-1]>=X[A[i]]:
            X[A[i]-1]=X[A[i]]-1
    if X[A[i]-1]>=2019:
        X[A[i]-1]=2019

for i in range(N):
    print(X[i])

Python: N = int(input())
koma = list(map(int, input().split()))
M = int(input())
order = list(map(int, input().split()))
koma.append(0)

for i in range(M):
    koma[order[i]-1] += 1
    if koma[order[i]-1] == koma[order[i]] or koma[order[i]-1] == 2020:
        koma[order[i]-1] -= 1

del koma[-1]
for v in koma:
    print(v)

Python: num = int(input())
L = [int(x) for x in input().split()]
L.append(2020)
input()
s = [int(x)-1 for x in input().split()]

for i in s:
    if L[i+1] > L[i] +1:
        L[i] += 1

for i in range(len(L) -1):
    print(L[i])