#include <bits/stdc++.h>
using namespace std;
int n, m, k, u, v;
vector<vector<int> > g;
bool used[100500];
vector<int> path;
bool edgeExists(int a, int b) {
  for (int i = 0; i < g[a].size(); ++i)
    if (g[a][i] == b) return true;
  return false;
}
bool dfs(int v) {
  used[v] = true;
  for (int i = 0; i < g[v].size(); ++i) {
    int to = g[v][i];
    if (!used[to]) {
      path.push_back(v);
      return dfs(to);
    }
  }
  path.push_back(v);
  return true;
}
int main() {
  scanf("%d %d %d", &n, &m, &k);
  g.resize(n + 1);
  for (int i = 0; i < m; ++i) {
    scanf("%d %d", &u, &v);
    g[v].push_back(u);
    g[u].push_back(v);
  }
  dfs(1);
  int t = 0;
  while (!edgeExists(path[t], path.back())) ++t;
  printf("%d\n", path.size() - t);
  for (int i = t; i < path.size(); ++i) printf("%d ", path[i]);
  return 0;
}
