import sys input = sys.stdin.readline int1 = lambda x: int(x) - 1 N, K, X = map(int, input().split()) C_def = list(range(N)) for _ in range(X - 1): a, b = map(int1, input().split()) C_def[a], C_def[b] = C_def[b], C_def[a] input() # `? ?` の入力を捨てる AB = [tuple(map(int1, input().split())) for _ in range(K - X)] AB.reverse() C = list(map(int1, input().split())) for a, b in AB: C[a], C[b] = C[b], C[a] ans = [] for i in range(N): if C_def[i] != C[i]: ans.append(i + 1) print(*ans)