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())
d = {i+1: v for i, v in enumerate(list(map(int, input().split())))}
m = int(input())
a = list(map(int, input().split()))

for i in a:
    if d[i]+1 not in d.values() and d[i] != 2019:
        d[i] += 1

print(*d.values(), sep="\n")

Python: input()
*X,=map(int,input().split())
input()
for a in map(int,input().split()):
    a-=1
    if X[a]<2019 and X[a]+1 not in X:
        X[a]+=1
print(*X,sep="\n")

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

for i in range (len(A)):
    for j in range(len(X)):
        cnt=0
        if A[i]==j+1:
            X[j]+=1
            for k in range (len(X)):
                if X[j]==X[k] and k!=j:
                    X[j]=X[j]-1
            if X[j]>2019:
                X[j]=X[j]-1
      
            
for i in range (len(X)):
    print(X[i])

Python: N=int(input())
x=list(map(int,input().split()))
M=int(input())
a=list(map(int,input().split()))
F=True    
for i in a:
    for j in range(N):
        #print(x[i-1])
        if x[i-1]+1 == x[j] or x[i-1] ==2019:
            F=False
            break
    if F==True:
        x[i-1]+=1
    F=True
for i in range(N):
    print(x[i])

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

for a in A:
    if X[a-1]+1 == X[a]: continue
    else: X[a-1] += 1
    
for x in X[:N]:
    print(x)

Python: N = int(input())
p = [int(i) for i in input().split()]
input()
O = [int(i) for i in input().split()]
for x in O:
    if p[x - 1] == 2019:
        continue
    if x < N and p[x - 1] + 1 == p[x]:
        continue
    p[x - 1] += 1

for x in p:
    print(x)

Python: n = int(input())
a = [int(s) for s in input().split()]
m = int(input())
b = [int(r) for r in input().split()]

for i in range(m):
    h = a[b[i]-1] + 1
    if a.count(h) == 0 and h != 2020:
        a[b[i]-1] = h
for t in a:
    print(t)

Python: # -*- coding: utf-8 -*-
"""
Sugoroku and Pieces
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0653

"""
import sys


class Piece:
    def __init__(self, pos):
        self.pos = pos


def main(args):
    _ = input()                 #  N
    board = [None] * 2020
    pieces = [Piece(0)]
    for p in map(int, input().split()):
        x = Piece(p)
        board[p] = x
        pieces.append(x)
    _ = input()                 #  M
    for p in map(int, input().split()):
        if pieces[p].pos == 2019 or board[pieces[p].pos + 1] != None:
            continue
        pos = pieces[p].pos
        pieces[p].pos += 1
        board[pos] = None
        board[pos + 1] = pieces[p]
    for p in pieces[1:]:
        print(p.pos)


if __name__ == '__main__':
    main(sys.argv[1:])

Python: S = [0]*2020

n = int(input())
X = [int(a) for a in input().split()]
for a in X:
  S[a] = 1

m = int(input())
M = [int(a) for a in input().split()]
for i in M:
  i = i - 1
  if X[i]+1 != 2020:
    if S[X[i]+1] == 0:
      S[X[i]+1] = 1
      S[X[i]] = 0
      X[i] = X[i]+1

for i in range(2020):
  if S[i] == 1:
    print(i)

Python: N=int(input())
Xin=input().split( )
X=[int(Xin[i]) for i in range(N)]

X.append(2020)
M=int(input())
Ain=input().split( )
A=[int(Ain[i]) for i in range(M)]

for t in range(M):
    j=A[t]-1
    if X[j]<X[j+1]-1:
        X[j]+=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()))

for v in a:
    if x[v-1]+1 in x or x[v-1]==2019:
        x[v-1]=x[v-1]
    else:
        x[v-1]+=1
for i in range(n):
    print(x[i])

Python: def main():
    n = int(input())
    pieces = list(map(lambda x: int(x), input().split()))
    m = int(input())
    operations = list(map(lambda x: int(x), input().split()))
    res = {}
    ans = []

    for i in range(2019):
        res[i] = 0

    for i in pieces:
        res[i - 1] = 1

    for i in operations:
        piece = pieces[i - 1]
        if piece >= 2019:
            continue
            
        if res[piece] == 1:
            pass
        else:
            res[piece - 1] = 0
            res[piece] = 1
            if (pieces[i - 1] + 1) < 2019:
                pieces[i - 1] += 1

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

if __name__ == '__main__':
    main()

Python: n=int(input())
koma=list(map(int,input().split()))
koma.append(2020)
m=int(input())
mi=list(map(int,input().split()))
for i in mi:
    if koma[i]>koma[i-1]+1:
        koma[i-1]+=1
koma.remove(2020)
for i in koma:
    print(i)

Python: N = int(input())
X = [int(x) for x in input().split()]
M = int(input())
A = [int(a) for a in input().split()]

for i in range(M):
    new_p = X[A[i]-1] + 1
    if new_p in X or new_p == 2020:
        continue
    X[A[i]-1] = new_p

for i in X:
    print(i)

Python: def main():
    N = int(input())
    x = [-1] + [int(i) for i in input().split()]
    x_set = set(x)
    M = int(input())
    A = [int(i) for i in input().split()]
    for i in range(M):
        posi = A[i]
        next_posi = x[posi] + 1
        if next_posi in x_set or next_posi > 2019:
            continue
        x_set.discard(x[posi])
        x_set.add(next_posi)
        x[posi] += 1

    print(*x[1:], sep="\n")


if __name__ == '__main__':
    main()

Python: N = int(input())

BASYO = [int(i) for i in input().split()]

M = int(input())

KOMA = [int(i) for i in input().split()]

for i in range(M):
    
    X = KOMA[i] - 1
    
    if (N != X + 1 and 1 == BASYO[X+1] - BASYO[X]) or BASYO[X] == 2019:
        pass
    
    else:
        BASYO[X] += 1
for i in range(N):
    print(BASYO[i])

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

MAX = 2019
MIN = 1

for i in range(M):
    if (X[A[i] - 1] + 1 in X) == False and X[A[i] - 1] != MAX:
        X[A[i] - 1] += 1

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

Python: tmp = [2020]*101
n = int(input())
X = list(map(int, input().split()))
m = int(input())
A = list(map(int, input().split()))
for i in range(n):
    tmp[i] = X[i]

for i in range(m):
    if (tmp[A[i]-1]+1) < tmp[A[i]]:
        tmp[A[i]-1] += 1

for i in range(n):
    print(tmp[i])

Python: n = int(input())
x = list(map(int,input().split()))
x.append(0)
m = int(input())
a = list(map(int,input().split()))
for i in a:
    i -= 1
    if x[i] != 2019 and x[i]+1 != x[i+1]:
        x[i] += 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()))
for x in A:
    if X[x-1] + 1 in X or X[x-1] == 2019:
        continue
    else:
        X[x-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()))

for i in range(M) :
  num = A[i] - 1
  x = X[num]
  if(x + 1 in X or x == 2019) :
    pass
  else :
    X[num] = x + 1

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