n, k, x = map(int, input().split()) x -= 1 a = [0] * k b = [0] * k for i in range(k): a[i], b[i] = input().split() c = list(map(int, input().split())) for i in range(n): c[i] -= 1 c0 = list(range(n)) for i in range(x): j1, j2 = int(a[i]) - 1, int(b[i]) - 1 c0[j1], c0[j2] = c0[j2], c0[j1] for i in range(k - 1, x, -1): j1, j2 = int(a[i]) - 1, int(b[i]) - 1 c[j1], c[j2] = c[j2], c[j1] res = [] for i in range(n): if (c0[i] != c[i]): res += [i + 1] print(*res)