#include <bits/stdc++.h>
using namespace std;
int cnt = 0;
vector<vector<int> > v(100005);
int vis[100005];
int num[100005];
int dfs(int p) {
  vis[p] = ++cnt;
  num[cnt] = p;
  for (int i = 0; i < v[p].size(); i++) {
    if (!vis[v[p][i]]) {
      dfs(v[p][i]);
      break;
    }
  }
  return 0;
}
int main() {
  int n, m, k;
  cin >> n >> m >> k;
  for (int i = 0; i < (m); i++) {
    int a, b;
    cin >> a >> b;
    v[a].push_back(b);
    v[b].push_back(a);
  }
  dfs(1);
  int o = 100009;
  for (int i = 0; i < v[num[cnt]].size(); i++) {
    o = min(o, vis[v[num[cnt]][i]]);
  }
  printf("%d\n", cnt - o + 1);
  for (int i = o; i <= cnt; i++) printf("%d ", num[i]);
  return 0;
}
