10
6 8
3 10
1 9
6 1
8 2
5 7
3 6
10 4
3 5
 1
 5
1 2
2 3
3 4
4 5
 7
2 3
2 6
1 2
3 7
6 5
3 4
 10
8 4
8 10
8 1
8 2
5 9
5 3
5 7
8 5
5 6
 10
8 6
3 4
10 9
7 10
1 3
4 2
6 1
5 8
9 5
 10
1 10
6 9
5 4
1 3
1 2
3 8
6 7
8 6
1 5
 20
13 4
7 6
9 13
9 2
9 16
4 18
16 5
11 15
16 14
13 12
13 8
16 17
7 1
9 19
17 3
15 20
1 11
2 7
5 10
 3
1 2
1 3
 50
18 47
18 12
42 16
21 44
43 39
20 27
25 1
11 29
9 24
19 42
3 34
16 38
14 48
23 41
8 43
29 2
40 4
45 36
43 9
49 3
41 17
41 15
35 49
43 20
5 32
34 46
8 21
43 45
29 40
39 26
27 33
24 50
38 7
39 19
43 31
24 10
3 14
39 22
43 23
47 13
20 11
25 8
16 30
44 18
19 37
39 5
49 28
25 35
46 6
 15
11 2
5 13
9 4
5 7
11 5
13 14
2 10
3 11
7 1
7 6
10 15
9 12
2 9
10 8
 31
15 2
23 19
11 4
26 6
1 20
14 11
19 13
26 12
12 27
20 14
22 21
4 16
10 18
5 23
4 31
12 8
2 17
19 30
14 26
2 28
22 7
23 9
20 5
5 15
9 29
15 10
6 25
6 24
9 3
11 22
 63
34 40
43 62
33 43
49 6
17 47
26 13
35 15
40 16
17 44
37 34
18 55
57 10
16 14
39 56
36 5
4 33
4 59
54 24
37 45
21 31
57 2
19 8
43 41
49 48
15 19
35 4
15 63
30 50
11 30
59 18
20 46
18 1
33 17
31 22
40 54
63 49
29 25
46 9
16 3
42 23
59 7
54 53
42 38
8 60
8 58
7 51
36 28
63 36
21 57
25 37
45 20
25 35
19 26
20 42
30 32
11 39
7 12
31 52
45 21
26 27
34 11
46 61

9
 1
 1
 1
 1
 2
 10
 18
 2
 13
 1
 3
 1

//μ's forever
#include <bits/stdc++.h>
#define N 100005
#define ll long long
#define mod 100000097
#define getchar nc
using namespace std;
inline char nc(){
    static char buf[100000],*p1=buf,*p2=buf;
    return p1==p2&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++;
}
inline int read()
{
    register int x=0,f=1;register char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9')x=(x<<3)+(x<<1)+ch-'0',ch=getchar();
    return x*f;
}
inline void write(register int x)
{
    if(!x)putchar('0');if(x<0)x=-x,putchar('-');
    static int sta[20];register int tot=0;
    while(x)sta[tot++]=x%10,x/=10;
    while(tot)putchar(sta[--tot]+48);
}
struct edge{
    int to,nxt;
}e[N<<1];
int head[N],ct;
inline void add(register int u,register int v)
{
    e[++ct]=(edge){v,head[u]};
    head[u]=ct;
}
int n,f[N],g[N],sz[N],sz2[N],ans,cur;
int p[N],cnt;
bool v[2000005];
set<int> s;
multiset<int> s2;
inline void init()
{
	for(register int i=2;i<=1299715;++i)
    {
		if(!v[i])
            p[++cnt]=i;
        // printf("%d\n",cnt);
		for(register int j=1;j<=cnt&&i*p[j]<=1299710;++j)
        {
			v[i*p[j]]=1;
			if(i%p[j]==0)
                break;
		}
	}
    // write(cnt);
}
inline void dfs1(register int x,register int fa)
{
    f[x]=1,sz[x]=1;
    for(register int i=head[x];i;i=e[i].nxt)
    {
        int v=e[i].to;
        if(v==fa)
            continue;
        dfs1(v,x);
        f[x]=(0ll+f[x]+1ll*f[v]*p[sz[v]]%mod)%mod;
        sz[x]+=sz[v];
        // s[x].insert(f[v]);
    }
}
inline void dfs2(register int x,register int fa)
{
    // ans=max(ans,(int)s[x].size());
    // if(ans<(int)s[x].size())
    //     ans=s[x].size(),cur=x;
    g[x]=(0ll+g[x]+f[x])%mod;
    for(register int i=head[x];i;i=e[i].nxt)
    {
        int v=e[i].to;
        if(v==fa)
            continue;
        g[v]=(0ll+g[x]-1ll*f[v]*p[sz[v]]%mod+mod)%mod*p[n-sz[v]]%mod;
        // g[v]
        // s[v].insert((0ll+f[x]+g[x]-1ll*f[v]*p[sz[v]]%mod+mod)%mod);
        dfs2(v,x);
    }
}
inline void dfs3(register int x,register int fa)
{
    // printf("%d %d\n",x,(int)s.size());
    if(ans<(int)s.size())
        ans=(int)s.size(),cur=x;
    // for(multiset<int>::iterator it=s2.begin();it!=s2.end();++it)
    //     printf("%d ",*it);
    // puts("\n");
    // if(x!=1)
    // {
    //     s.insert(g[x]);
    //     s2.insert(g[x]);
    // }
    for(register int i=head[x];i;i=e[i].nxt)
    {
        int v=e[i].to;
        if(v==fa)
            continue;
        s2.insert((0ll+g[x]-1ll*f[v]*p[sz[v]]%mod+mod)%mod);
        s.insert((0ll+g[x]-1ll*f[v]*p[sz[v]]%mod+mod)%mod);
        // s2.erase(f[v]);
        s2.erase(s2.find(f[v]));
        if(s2.find(f[v])==s2.end())
            s.erase(f[v]);
        // printf("%lld %d %d 233\n",(0ll+g[x]-1ll*f[v]*p[sz[v]]%mod+mod)%mod,f[v],f[10]);
        // printf("%d\n",f[10]);
        dfs3(v,x);
        s2.insert(f[v]);
        s.insert(f[v]);
        //s2.erase((0ll+g[x]-1ll*f[v]*p[sz[v]]%mod+mod)%mod);
        s2.erase(s2.find((0ll+g[x]-1ll*f[v]*p[sz[v]]%mod+mod)%mod));
        if(s2.find((0ll+g[x]-1ll*f[v]*p[sz[v]]%mod+mod)%mod)==s2.end())
            s.erase((0ll+g[x]-1ll*f[v]*p[sz[v]]%mod+mod)%mod);
    }
    // if(x!=1)
    // {
    //     s2.erase(g[x]);
    //     if(s2.find(g[x])==s2.end())
    //         s.erase(g[x]);
    // }
}
int main()
{
    init();
    n=read();
    for(register int i=1;i<n;++i)
    {
        int u=read(),v=read();
        add(u,v),add(v,u);
    }
    dfs1(1,0);
    dfs2(1,0);
    for(register int i=2;i<=n;++i)
    {
        s.insert(f[i]),s2.insert(f[i]);
        // if(f[i]==1)
            // printf("%d\n",i);

    }
    // for(register int i=1;i<=n;++i)
    //     printf("%d %d\n",f[i],g[i]);
    dfs3(1,0);
    write(cur);
	return 0;
}
