#include <bits/stdc++.h>
using namespace std;
int n, e, k;
vector<int> g[100010];
map<int, int> m;
bool usato[100010];
vector<int> path;
void dfs(int v) {
  usato[v] = true;
  path.push_back(v);
  m[v] = path.size();
  for (int i = 0; i < g[v].size(); i++)
    if (!usato[g[v][i]]) {
      dfs(g[v][i]);
      return;
    }
}
int main() {
  cin >> n >> e >> k;
  for (int i = 0; i < e; i++) {
    int a, b;
    cin >> a >> b;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  dfs(1);
  int v = path[path.size() - 1];
  int p = g[v][0];
  for (int i = 1; i < g[v].size(); i++)
    if (m[p] > m[g[v][i]]) p = g[v][i];
  vector<int> sol;
  int index = 0;
  while (path[index] != p) index++;
  for (index; index < path.size(); index++) sol.push_back(path[index]);
  cout << sol.size() << endl;
  for (int i = 0; i < sol.size(); i++) cout << sol[i] << " ";
  cout << endl;
  return 0;
}
