#!/usr/bin/env python3 """ Determine the connected components; see if they can be assembled to sum up to k. This works, for instance, on all graphs in data/secret/small """ from collections import Counter n, m, k = map(int, input().split()) V = list(range(1, n+1)) edges = [] for _ in range(m): edges.append(tuple(map(int, input().split()))) parent = { u: u for u in V } size = { u: 0 for u in V } # number of edges(!) def root(w): while w != parent[w]: w = parent[w] return w for u, v in edges: ru, rv = root(u), root(v) if ru == rv: size[ru] += 1 continue # weighted union by edge size if size[ru] > size[rv]: u, v = v, u size[root(v)] += size[root(u)] + 1 parent[root(u)] = root(v) component_sizes = Counter(size[u] for u in V if parent[u] == u) # If k becomes larger than k, do this programmatically: partitions = { 1: [{1:1}], 2: [{2:1}, {1:2}], 3: [{3:1}, {1:3}, {1:1, 2:1}], 4: [{4:1}, {1:4}, {3:1, 1:1}, {1:2, 2:1}], 5: [{5:1}, {1:5}, {4:1, 1:1}, {3:1, 1:2}, {3:1, 2:1}, {2:2, 1:1}], 6: [{6:1}, {1:6}, {5:1, 1:1}, {3:1, 1:3}, {3:1, 2:1, 1:1}, {3:2}, {4:1, 1:2}, {4:1, 2:1} ], }[k] for d in partitions: for i, sz in d.items(): if component_sizes[i] < sz: break else: # Enough components of the necessary sizes are present # Scan through the vertices and covers those components components_to_report = set() for u in V: if parent[u] == u and size[u] in d and d[size[u]] > 0: components_to_report.add(u) d[size[u]] -= 1 cover = [u for u in V if root(u) in components_to_report] print("yes") print(len(cover)) print(*cover) break else: print("no")