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: 435ms
Memory: 26096kB
Author: 13373882502
In contest: 1300

n,t=map(int,input().split())
lst= input().split()

for n in range(t):
    a=input().split()
    lst.insert(lst.index(a[1]), a[0])

for m in lst:
    print(m,end=" ")