#include <bits/stdc++.h>
inline int getInt() {
  int s;
  scanf("%d", &s);
  return s;
}
using namespace std;
vector<int> g[100000];
int flag[100000];
int main() {
  const int n = getInt();
  const int m = getInt();
  const int k = getInt();
  for (int i = 0; i < (int)(m); i++) {
    const int a = getInt() - 1;
    const int b = getInt() - 1;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  vector<int> ans;
  vector<int> r(n);
  vector<int> f(n);
  ans.push_back(0);
  f[0] = 1;
  int idx = 0;
  for (int j = 0;; j++) {
    bool ok = false;
    for (int i : g[idx]) {
      if (f[i] == 0) {
        f[i] = 1;
        idx = i;
        ans.push_back(i);
        r[i] = j + 1;
        ok = true;
        break;
      }
    }
    if (!ok) {
      int mn = n;
      for (int k : g[idx]) {
        mn = min(mn, r[k]);
      }
      printf("%d\n", ans.size() - mn);
      for (int k = mn; k < (int)ans.size(); k++) {
        printf("%d%c", ans[k] + 1, k == (int)ans.size() - 1 ? '\n' : ' ');
      }
      break;
    }
  }
  return 0;
}
