{"raw_statement":[{"iden":"problem statement","content":"Given is a tree with $N$ vertices. The vertices are numbered $1,2,\\ldots ,N$, and the $i$\\-th edge is an undirected edge connecting Vertices $u_i$ and $v_i$.\nFor each integer $i\\,(1 \\leq i \\leq N)$, find $\\sum_{j=1}^{N}dis(i,j)$.\nHere, $dis(i,j)$ denotes the minimum number of edges that must be traversed to go from Vertex $i$ to Vertex $j$."},{"iden":"constraints","content":"*   $2 \\leq N \\leq 2 \\times 10^5$\n*   $1 \\leq u_i < v_i \\leq N$\n*   The given graph is a tree.\n*   All values in input are integers."},{"iden":"input","content":"Input is given from Standard Input in the following format:\n\n$N$\n$u_1$ $v_1$\n$u_2$ $v_2$\n$\\vdots$\n$u_{N-1}$ $v_{N-1}$"},{"iden":"sample input 1","content":"3\n1 2\n2 3"},{"iden":"sample output 1","content":"3\n2\n3\n\nWe have:\n$dis(1,1)+dis(1,2)+dis(1,3)=0+1+2=3$,\n$dis(2,1)+dis(2,2)+dis(2,3)=1+0+1=2$,\n$dis(3,1)+dis(3,2)+dis(3,3)=2+1+0=3$."},{"iden":"sample input 2","content":"2\n1 2"},{"iden":"sample output 2","content":"1\n1"},{"iden":"sample input 3","content":"6\n1 6\n1 5\n1 3\n1 4\n1 2"},{"iden":"sample output 3","content":"5\n9\n9\n9\n9\n9"}],"translated_statement":null,"sample_group":[],"show_order":["default"],"formal_statement":null,"simple_statement":null,"has_page_source":true}