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: 397ms
Memory: 25780kB
Author: 18605753875
In contest: 1300

n,t=map(int,input().split())
l=list(map(int,input().split()))
for tt in range(t):
    new,old=map(int,input().split())
    l.insert(l.index(old),new)
l=list(map(str,l))
print(" ".join(l))