Start: Jul, 06, 2019 10:00:00
20190706Python程序设计基础培训扩展练习
End: Jul, 17, 2019 12:00:00
Time elapsed:
Time remaining:

Problem_ID: G
Result: Accepted
Time: 382ms
Memory: 25896kB
Author: 13373882502
In contest: 1300

n,t=map(int,input().split())
lst=[]
lst= list(map(int,input().split()))
##print(lst)
for n in range(t):
    a,b=map(int,input().split())
    lst.insert(lst.index(b), a)
##print(lst)
for m in lst[:-1]:
    print(m,end=" ")
print(lst[-1])