#include<cstdio>
#include<cstring>
#include<algorithm>
#define maxn 100000000
int son[maxn],hson[maxn],top[maxn],deep[maxn],id[maxn],tree[maxn];
int to[maxn],next[maxn],pre[maxn];
int color[maxn],soncolor[maxn];
int n,m,M;
inline int RD()
{
char ch;
int res=0;
ch=getchar();
while(ch<‘0‘||ch>‘9‘)ch=getchar();
res=ch-‘0‘;
while((ch=getchar())>=‘0‘&&ch<=‘9‘)res=res*10+ch-‘0‘;
return res;
}
void addedge(int a,int b)
{
static int tip=0;
next[++tip]=pre[a],pre[a]=tip,to[tip]=b;
next[++tip]=pre[b],pre[b]=tip,to[tip]=a;
}
void dfs1(int father,int now)
{
deep[now]=deep[father]+1;
for(int i=pre[now];i;i=next[now])
{
if(to[i]!=father)
{
dfs1(now,to[i]);
son[now]+=son[to[i]];
if(son[to[i]]>son[hson[now]])hson[now]=to[i];
}
}
if(!son[now])son[now]=1;
}
void dfs2(int father,int now)
{
static int ID=0;
id[now]=++ID;
if(hson[now])dfs2(now,hson[now])
}
int main()
{
n=RD(),m=RD();
for(int i=1;i<=n;i++)color[i];
for(int i=1;i<n;i++)addedge(RD(),RD());
for(M=1;M<n;M>>1);
dfs1(1,1);dfs2(1,1);
}