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())) #どこの変化

for i in range(0,M):
    #print(A)
    #print(M)
    #print(X[A[i]-1])
    
    if (X[A[i]-1]+1 not in X) and X[A[i]-1]+1 <=2019:
        #print("not in",X[A[i]-1]+1,X)
        s=X[A[i]-1]
        X.insert(A[i],X[A[i]-1]+1)
        #print("X ",X)
        #print(s)
        X.remove(s)
        #print(X)

#print(" ")

X.sort()    
for i in range(len(X)):
    print(X[i])

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

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

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

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

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


for i in range (M):
    if A[i] == N and (X[A[i]-1] != 2019): 
        X[A[i]-1]=1+X[A[i]-1]
    elif  X[A[i]-1]==2019:
        continue 
    elif X[A[i]-1]+1 != X[A[i]] :
        X[A[i]-1]+=1


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

Python: # coding: utf-8
# Your code here!
def keisan(a,b):
    
    if a>2019:
        return True
    
    i=0
    while i<len(b):
        if b[i]==a :
            return True
        i+=1
    
    return False
    


koma_kazu=int(input()) #3

koma=input().rstrip().split()
komaI=[int(s) for s in koma]  #2,3,6

idou_kazu=int(input()) #2

idou=input().rstrip().split()
idouI=[int(s) for s in idou] #1,3


i=0
while i<idou_kazu:
    #if komaI[idouI[i]-1]+1 in komaI==False:
    if keisan(komaI[idouI[i]-1]+1,komaI)==False:
        komaI[idouI[i]-1]+=1
    i+=1

i=0
while i<koma_kazu:
    print(komaI[i])
    i+=1

Python: num=int(input())
koma_n=input().split()
koma_n = [int(s) for s in koma_n]
times=int(input())
which=input().split()
which  = [int(s) for s in which]

for i in range(times):
    flag=0
    for j in range(which[i]-1,num):
        if koma_n[which[i]-1]+1==koma_n[j]:
          flag=1
          break
   
    if flag==0 and koma_n[which[i]-1]<=2018:
        koma_n[which[i]-1]+=1

for i in range(num):
    print(koma_n[i])

Python: N = input("")
X = input("").split(" ")
M = input("")
A = input("").split(" ")

for a in A:
    index = int(a) - 1
    if X[index] == "2019":
        continue
    if not str(int(X[index]) + 1) in X:
        X[index] = str(int(X[index]) + 1)
for x in X:
    print(x)

Python: n=int(input())
x=[int(i) for i in input().split()]

mas=[False]*2020
for i in x:
    mas[i]=True
m=int(input())
a=[int(i) for i in input().split()]

for i in range(m):
    now=x[a[i]-1]
    if now==2019:
        continue
    elif mas[now+1]:
        continue
    mas[now],mas[now+1]=False,True
    x[a[i]-1]+=1

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

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

x.insert(0,0)
a.insert(0,0)

for i in range(1,m+1):
    if x[a[i]] == 2019:
        pass
    elif a[i] == n:
        x[a[i]] = x[a[i]]+1
    elif x[a[i]]+1 != x[a[i]+1]:
        x[a[i]] = x[a[i]]+1


x.pop(0)
print(*x,sep = '\n')

Python: # -*- coding: utf-8 -*-
# 学籍番号 17D8101029G 石塚 博之 ID: mcatpolo 言語: python3

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



for i in range(0, M):
    if X[A[i]-1]+1 not in X and X[A[i]-1] < 2019:
        X[A[i]-1] += 1

for i in X:
    print(i)

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

for mi in a:
    if x[mi-1] + 1 in x:
        pass
    else :
        x[mi-1] = min(2019, x[mi-1] + 1)

for i in x:
    print(i)

Python: N=int(input())

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

M=int(input())

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

for i in A:

    if ( (X[i-1]+1) in X) or (X[i-1]==2019):
        pass
    else:
        X[i-1]+=1

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

Python: N = int(input())
X_N = [int(i) for i in input().split()]
M = int(input())
A_M = [int(i) for i in input().split()]

for i in range(0, M):
    if (X_N[A_M[i]-1] != 2019) and ((A_M[i] == N) or (X_N[A_M[i]] != X_N[A_M[i]-1] + 1)):
        X_N[A_M[i]-1] += 1
        
for i in range(0, N):
    print(X_N[i])

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

GOAL = 2019


for a in A:
    if len(X) > a and (X[a-1] + 1) == X[a]:
        continue
    if X[a-1] == GOAL:
        continue
    X[a-1] = X[a-1] + 1
    
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()))
A=[A[i]-1 for i in range(len(A))]

for i in range(M):
    l=A[i]
    if X[l]+1 not in X and X[l]!=2019:
        X[l]+=1
print(format("\n".join(map(str,X))))

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

goal = 2019

v = [i in x for i in range(goal+1)]

int(input())
for a in map(int, input().split()):
    count = 0
    for i in range(goal + 1):
        if v[i]:
            count += 1
            if count == a:
                break

    if i < goal and v[i + 1] is False:
        v[i] = False
        v[i+1] = True

for i in range(goal + 1):
    if v[i]:
        print(i)

Python: 
def solve():
    N = int(input())
    X = [int(i) for i in input().split()]
    M = int(input())
    A = [int(i) for i in input().split()]
    for a in A:
        if not X[a - 1] + 1 in X:
            X[a - 1] = min(X[a - 1] + 1, 2019)
    for x in X:
        print(x)


if __name__ == '__main__':
    solve()

Python: a=int(input())
Xin=input().split( )
X=[int(Xin[i]) for i in range(a)]
 
X.append(2020)
b=int(input())
Ain=input().split( )
A=[int(Ain[i]) for i in range(b)]
 
for t in range(b):
    j=A[t]-1
    if X[j]<X[j+1]-1:
        X[j]+=1
for i in range(a):
    print(X[i])

Python: #! /usr/bin/env python
# -*- coding: utf-8 -*-
import sys


def main():
    n = int(input())
    arrx = list(map(int,input().split()))
    m = input()
    arra = list(map(int,input().split()))
    for i in arra:
        if(i == n ):
            if(arrx[i-1] < 2019):
                arrx[i-1] += 1
        else:
            if(arrx[i-1] + 1 < arrx[i] and arrx[i-1] < 2019):
                arrx[i-1] += 1
    for i in arrx:
        print(i)

if __name__ == '__main__':
    main()

Python: n = int(input())
x = list(map(int, input().split())) + [2020]
m = int(input())
for i in map(int, input().split()): x[i-1]=min(x[i-1]+1,x[i]-1)
for i in range(n): print(x[i])