N,K,X = map(int,input().split()) query = [] for _ in range(K): if _ != X - 1: a,b = map(int,input().split()) query.append((a,b)) else: input() query.append((-1,-1)) C = list(map(int,input().split())) A = list(range(1,N+1)) for i in range(X-1): a,b = query[i] A[a-1],A[b-1] = A[b-1],A[a-1] for i in range(K-1,X-1,-1): a,b = query[i] C[a-1],C[b-1] = C[b-1],C[a-1] l = [] for i in range(N): if A[i] != C[i]: l.append(i+1) print(*l)