#include using namespace std; using ll = long long; using ld = long double; using pll = pair; using vll = vector; using vld = vector; using vpll = vector; using vvll = vector; vvll graph; vector visited; list dfs(ll v, bool b){ visited[v] = true; list result; for (ll w : graph[v]) if (!visited[w]) result.splice(result.begin(), dfs(w,!b)); if (b) result.push_back(v); else result.push_front(v); return result; } int main(){ ll n, m; cin >> n >> m; graph = vvll(n+1,vll{}); visited = vector(n+1,false); for (int i=0;i> x >> y; graph[x].push_back(y); graph[y].push_back(x); } list result = dfs(1, true); for (ll i : result) cout << i << ' '; cout << endl; return 0; }