program pianfen;
var
n,j,k,a,b:integer;
shu:array[1..50]of integer;
biaozhi:array[0..50,0..50]of boolean;
jilu:array[1..50]of boolean;
procedure jisuan(step:integer);
var
i:integer;
begin
if step>n then
exit;
for i:=2 to n do
if (biaozhi[shu[step-1],i]=true)and(jilu[i]=false)then
begin
shu[step]:=i;
jilu[i]:=true;
if (step=n)and(biaozhi[1,i]=true) then
begin
write ('1',' ');
for j:=2 to n do
write (shu[j],' ');
writeln;
close (input);
close (output);
halt
end
else
jisuan(step+1);
jilu[i]:=false;
shu[step]:=0
end
end;
begin
assign (input,'resume.in');
reset (input);
assign (output,'resume.out');
rewrite (output);
readln (n);
for k:=1 to n do
for j:=1 to n do
biaozhi[k,j]:=false;
repeat
readln (a,b);
biaozhi[a,b]:=true;
biaozhi[b,a]:=true
until a=0;
for k:=1 to n do
jilu[k]:=false;
jilu[1]:=true;
shu[1]:=1;
jisuan (2);
writeln (n);
close (input);
close (output)
end.