head数组表示以某个点为起点的第一条边
next数组表示以某个点为起点的下一条边
to数组表示边的重点
int con=1;
memset(head,0,sizeof(head));
for(int i=1;i<n;++i)
{
int a,b;
scanf("%d%d",&a,&b);
to[con]=b;
Next[con]=head[a];
head[a]=con++;
to[con]=a;
Next[con]=head[b];
head[b]=con++;
}
for(int i=head[a];i>0;i=Next[i])
{
}