Untitled

mail@pastecode.io avatar
unknown
plain_text
7 months ago
307 B
1
Indexable
Never
n=input().split()
n=[int(i)for i in (n)]
#print (n)
x=n[0] 
y=n[1]

#print (x)
#print (y)
a=input().split() 
a=[i for i in (a)]
#print (a)
c=1
while c<=y:
    b=input().split()
    b=[int(x)  for x in (b)]
    #print (b)
    
    a[b[0]],a[b[1]]=a[b[1]],a[b[0]]
    c=c+1

for i in (a):
    print(i,end=" ")