i,r=input,range n,k,t=map(int,i().split()) L=[0]*k for j in r(k):L[j]=i().split() B=list(map(int,i().split())) A=sorted(B) for j in r(t-1): x,y=int(L[j][0])-1,int(L[j][1])-1 A[x],A[y]=A[y],A[x] for j in r(k-1,t-1,-1): x,y=int(L[j][0])-1,int(L[j][1])-1 B[x],B[y]=B[y],B[x] C=[] for j in r(n): if A[j]!=B[j]:C.append(j+1) print(*C)