# Points # 拡張ダイクストラ import heapq N, M, P = map(int, input().split()) start, goal = map(int, input().split()) G = [[] for i in range(2*10**5+1)] for i in range(M): u, v = map(int, input().split()) G[u].append(v+10**5) G[v].append(u+10**5) G[u+10**5].append(v) G[v+10**5].append(u) que = [] heapq.heapify(que) d_s = [10**10 for i in range(2*10**5+1)] d_s[start] = 0 heapq.heappush(que, (0, start)) while que: cost, v = heapq.heappop(que) if d_s[v] < cost: continue for e in G[v]: if d_s[e] > d_s[v] + 1: d_s[e] = d_s[v] + 1 heapq.heappush(que, (d_s[e], e)) d_g = [10**10 for i in range(2*10**5+1)] d_g[goal] = 0 heapq.heappush(que, (0, goal)) while que: cost, v = heapq.heappop(que) if d_g[v] < cost: continue for e in G[v]: if d_g[e] > d_g[v] + 1: d_g[e] = d_g[v] + 1 heapq.heappush(que, (d_g[e], e)) is_accessible = [0 for i in range(N+1)] for node in range(1, N+1): flag = False for i in range(2): for j in range(2): v = d_s[node + i*10**5] + d_g[node+j*10**5] if v <= P and v % 2 == P % 2: is_accessible[node] = 1 K = sum(is_accessible) print(K) for i in range(1, N+1): if is_accessible[i] == 1: print(i)