var
s:array[1..10000] of longint;
f:array[1..10000,1..10000] of boolean;
a,d:array[1..10000] of boolean;
n:longint;
procedurexxoo(x:longint);var
i:longint;
c:boolean;
begin
a[x]:=false;
c:=true;
for i:=1to n dobeginif (f[i,x])and(a[i]) thenbegin
xxoo(i);
s[x]:=s[x]+s[i];
if s[i]>n div2then
c:=false;
end;
end;
if n-s[x]>n div2then
c:=false;
if c then d[x]:=true;
end;
var
i,x,y:longint;
c:boolean;
begin
readln(n);
for i:=1to n-1dobegin
readln(x,y);
f[x,y]:=true;
f[y,x]:=true;
end;
fillchar(a,sizeof(a),true);
for i:=1to n do
inc(s[i]);
xxoo(1);
for i:=1to n doif d[i] then writeln(i);
end.