#include <bits/stdc++.h>
using namespace std;
const int maxn = 111111;
int n, m, k, path[maxn], belong[maxn], pathLen;
vector<int> g[maxn];
bool vis[maxn];
void dfs(int pos) {
  vis[pos] = true;
  path[++pathLen] = pos;
  belong[pos] = pathLen;
  for (vector<int>::iterator it = g[pos].begin(); it != g[pos].end(); it++) {
    int v = (*it);
    if (!vis[v]) {
      dfs(v);
      break;
    }
  }
}
int main() {
  ios::sync_with_stdio(false);
  memset(vis, false, sizeof(vis));
  cin >> n >> m >> k;
  for (int i = 1; i <= m; ++i) {
    int u, v;
    cin >> u >> v;
    g[u].push_back(v);
    g[v].push_back(u);
  }
  dfs(1);
  int pos, minNum = 0x7FFFFFFF / 2;
  for (vector<int>::iterator it = g[path[pathLen]].begin();
       it != g[path[pathLen]].end(); it++) {
    if (belong[(*it)] < minNum && vis[(*it)]) {
      minNum = belong[(*it)];
      pos = (*it);
    }
  }
  cout << pathLen - minNum + 1 << endl;
  for (int i = minNum; i <= pathLen - 1; ++i) cout << path[i] << " ";
  cout << path[pathLen] << endl;
  return 0;
}
