const
maxn=50;
var
a:array[1..maxn,1..maxn] of boolean;
flag:array[1..maxn] of boolean;
ans:array[1..maxn] of integer;
ansp:integer;
n:integer;
procedure init;
var
i:integer;
x,y:integer;
begin
assign(input,'resume.in');reset(input);
assign(output,'resume.out');rewrite(output);
readln(n);
fillchar(a,sizeof(a),false);
while not eof do begin
readln(x,y);
a[x,y]:=true;
a[y,x]:=true;
end;
close(input);
end;
procedure print;
var
i:integer;
begin
write(1);
for i:=2 to n do write(' ',ans[i]);
writeln;
close(output);
halt;
end;
procedure main(step:integer);
var
i:integer;
begin
for i:=1 to n do
if flag[i] and a[step,i] then begin
flag[i]:=false;
inc(ansp);
ans[ansp]:=i;
if (ansp=n) and a[i,1] then print else main(i);
flag[i]:=true; dec(ansp);
end;
end;
begin
init;
fillchar(flag,sizeof(flag),true);
flag[1]:=false; ans[1]:=1;
ansp:=1;
main(1);
writeln;
close(output);
end.