n = int(input()) list1 = list(map(int, input().split())) s, m = map(int, input().split()) list1[s - 1] = m print(*list1)