A monochrome tree is a tree in which each vertex is colored either white or black. The score of a monochrome tree is equal to the number of unordered vertex pairs (u,v) such that:
You are given a rooted tree of n vertices whose root vertex is 1.
For each k from 0 to n (inclusive), you may color the given tree in such a way that there are exactly k black vertices and n−k white vertices. Among all the possible colorings, we denote the lowest score of a coloring as c_k.
Find c_k for all 0≤k≤n.
The first line contains a single integer n, the number of vertices in the given tree. (1≤n≤2×105).
The i-th line of the following n−1 lines contain a single integer p_i+1 (1≤p_i+1≤n, p_i+1=i+1), meaning that the parent of vertex i+1 is p_i+1.
On the first and only line, print n+1 integers, the i-th of which denotes c_i−1. (1≤i≤n+1)
Vertex x is an ancestor of vertex y (x=y) if there is a sequence of vertices x=a_1,a_2,…a_k=y where a_i is a parent of a_i+1 (1≤i≤k−1).