#include #include using namespace std; #define N 30010 int n,fa[N],d[N],cnt[N]; void Init() { for(int i=1;i