#include <cstdio>
#include <vector>
#include <queue>
typedef unsigned U;
const U memory = 200001, save = 0x3FFFFFFF;
std::vector<U> Graph[memory];
U graphSize[memory], n, d, nodesTest;
std::queue<U> ToDelete;
void bFS() {
U v;
while (!ToDelete.empty()) {
v = ToDelete.front();
ToDelete.pop();
for (U u, i = 0; i < Graph[v].size(); ++i) {
u = Graph[v][i];
if (--graphSize[u] < d) {
graphSize[u] = save;
ToDelete.push(u);
}
}
}
}
void dFS(U v, U nodesSign) {
++nodesTest;
graphSize[v] = nodesSign;
ToDelete.push(v);
while (!ToDelete.empty()) {
v = ToDelete.front();
ToDelete.pop();
for (U u, i = 0; i < Graph[v].size(); ++i) {
u = Graph[v][i];
if (graphSize[u] < n) {
++nodesTest;
graphSize[u] = nodesSign;
ToDelete.push(u);
}
}
}
}
int main() {
U m;
scanf("%u%u%u", &n, &m, &d);
for (U a, b, i = 0; i < m; ++i) {
scanf("%u%u", &a, &b);
Graph[a].push_back(b);
Graph[b].push_back(a);
}
for (U i = 1; i <= n; ++i) {
if (Graph[i].size() < d) {
graphSize[i] = save;
ToDelete.push(i);
}
else
graphSize[i] = Graph[i].size();
}
bFS();
U nodesMax = 0, nodesSign = n - 1, nodesSignMax;
for (U i = 1; i <= n; ++i) {
if (graphSize[i] < n) {
nodesTest = 0;
dFS(i, ++nodesSign);
if (nodesMax < nodesTest) {
nodesMax = nodesTest;
nodesSignMax = nodesSign;
}
}
}
if (nodesMax) {
printf("%u\n", nodesMax);
for (U i = 1; i <= n; ++i)
if (graphSize[i] == nodesSignMax)
printf("%u ", i);
}
else
printf("NIE");
printf("\n");
return 0;
}