#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
vector<int> v[N], p;
bool f[N];
void dfs(int i) {
  f[i] = true;
  p.push_back(i);
  for (int j = 0; j < v[i].size(); j++) {
    if (!f[v[i][j]]) {
      dfs(v[i][j]);
      return;
    }
  }
}
int main() {
  int n, m, k;
  cin >> n >> m >> k;
  for (int i = 0; i < m; i++) {
    int x, y;
    cin >> x >> y;
    x--;
    y--;
    v[x].push_back(y);
    v[y].push_back(x);
  }
  dfs(0);
  int j = 0;
  while (find(v[p[j]].begin(), v[p[j]].end(), p.back()) == v[p[j]].end()) j++;
  cout << p.size() - j << endl;
  for (int i = j; i < p.size(); i++) {
    cout << p[i] + 1 << " ";
  }
  cout << endl;
}
