program resume;
const
maxn = 50;
var
n: longint;
l: array[1..maxn,0..maxn] of longint;
used: array[1..maxn] of boolean;
pos,a: array[1..maxn] of longint;
procedure init;
var
i,x,y: longint;
begin
readln(n);
for i :=1 to n do begin
readln(x,y);
inc(l[x][0]); l[x][l[x][0]] :=y;
inc(l[y][0]); l[y][l[y][0]] :=x;
end;
end;
function Check(k,x:longint):boolean;
var
i,v,j,u,p,r: longint;
begin
for i :=1 to l[x][0] do begin
v :=l[x][i];
if used[v] then
for j :=pos[v]+1 to k-1 do
begin
u :=a[j];
for r :=1 to l[u][0] do begin
p :=l[u][r];
if (used[p]) and (pos[p]<pos[v])
or (not used[p]) and (p <>x) then exit(false);
end;
end;
end;
exit(true);
end;
procedure print;
var
i: longint;
begin
for i :=1 to n-1 do write(a[i],' ');
writeln(a[n]);
close(input); close(output); halt;
end;
procedure solve(k:longint);
var
i: longint;
begin
if k >n then print;
for i :=1 to n do if not used[i]
then if Check(k,i)
then begin
used[i] :=true;
pos[i] :=k;
a[k] :=i;
solve(k+1);
used[i] :=false;
pos[i] :=0;
a[k] :=0;
end;
end;
procedure main;
begin
solve(1);
end;
begin
assign(input,'resume.in'); reset(input);
assign(output,'resume.out'); rewrite(output);
init;
main;
close(input); close(output);
end.