//#pragma GCC optimize(2)
#include<bits/stdc++.h>
#define ps ' '
#define Edl '\n'
#define debug(x) cerr<<#x<<':'<<x<<'\n';
#define edl '\n'
#define cehh cerr<<'\n';
typedef long long ll;
using namespace std;
inline ll read(){ll x=0,f=1;char ch=getchar();while(ch<'0'||ch>'9') {if(ch=='-')f=-1;ch=getchar();}while(ch>='0'&&ch<='9') x=(x<<1)+(x<<3)+(ch^48),ch=getchar();return x*f;}
void wrint(ll x,short e){if(x<0){putchar('-');x=-x;}if(x>9){wrint(x/10,0);}putchar(x%10+'0');if(e==1){putchar('\n');}if(e==2){putchar(' ');}}//0:啥也不加 1:换行 2:空格
const ll N=1e3 +10,INF=0x7f7f7f7f7f7f7f7f;
struct node{
int v,id;
}o;
vector<node> e[N];
ll n=0,m=0,k=0,ans=0,du[N],p1,p2,num;
bool vis[N];
bool operator <(const node &a,const node &b){
return a.v<b.v;
}
bool operator >(const node &a,const node &b){
return a.v>b.v;
}
void dfs(int u){
wrint(u,1);
for(auto i:e[u]){
if(!vis[i.id]){
vis[i.id]=1;
dfs(i.v);
break;
}
}
}
int main(){
// freopen("123.in","r",stdin);
// freopen("123.out","w",stdout);
m=read();
for(int i=1;i<=m;i++){
int u=read(),v=read();
o.id=i;
o.v=u;
e[v].push_back(o);
o.v=v;
e[u].push_back(o);
du[u]++;
du[v]++;
n=max(n,1ll*max(u,v));
}
for(int i=1;i<=n;i++){//判断奇数度点的数量
sort(e[i].begin(),e[i].end());
if(du[i]%2){
if(p1) p2=i;
else p1=i;
}
}
if(p1){
dfs(p1);
}else{
dfs(1);
}
// fclose(stdin);
// fclose(stdout);
return 0;
}
rt,下下来数据之后发现少输出了几个点,哪位奆佬帮帮我qwq