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

Problem_ID: G
Result: Accepted
Time: 392ms
Memory: 25864kB
Author: 13777726382
In contest: 1296

while True:
    try:
        n,m = map(int,input().split())
        lst = list(map(int,input().split()))
        for t in range(m):
            a,b = map(int,input().split())
            i = lst.index(b)
            lst.insert(i,a)
        for nn in lst:
            print(nn,end=" ")
        print()
    except EOFError:
        break