n = int(input()) a = list(map(int,input().split())) x,y = map(int,input().split()) a[x-1] = y print(*a)