#include<bits/stdc++.h> using namespace std; int n,e,a[501][501],x,y,c; void dfs(int x){ cout<<x<<endl; for(int j=1;j<=c;j++){ if(a[x][j]==1){ a[x][j]=0; a[j][x]=0; dfs(j); } } } int main(){ cin>>e; for(int i=1;i<=e;i++){ cin>>x>>y; c=max(max(x,y),c); a[x][y]=1; a[y][x]=1; a[x][0]++; a[y][0]++; } dfs(1); return 0; } /************************************************************** Problem: 2054 User: chenpengxi Language: C++ Result: Wrong Answer ****************************************************************/