#include #define REP(i,n) for(int i=0,i##_len=int(n);i>N; vector> graph(N); REP(i,N-1){ int a,b; cin>>a>>b; a--;b--; graph[a].push_back(b); graph[b].push_back(a); } vector ch(N); vector> chs(N); function dfs = [&](int u,int pre){ ll res = 1; for(auto v:graph[u]){ if(v == pre) continue; res += dfs(v,u); chs[u].push_back(v); } return ch[u] = res; }; dfs(0,-1); REP(i,N){ ll ans = ch[i]*ch[i]; for(auto v:chs[i]){ ans -= ch[v]*ch[v]; } cout<