#include using namespace std; int main() { int N; cin >> N; vector> G(N); for (int i = 0; i < N - 1; i++){ int u, v; cin >> u >> v; u--; v--; G[u].push_back(v); G[v].push_back(u); } for (int i = 0; i < N; i++){ set s; for (int v : G[i]){ for (int v2 : G[v]){ if (v2 != i){ s.insert(v2); } } } cout << s.size() << '\n'; } }