#define _USE_MATH_DEFINES #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; using ll = long long; int N; vector G[303030]; int main() { cin >> N; for(int i = 0; i < N-1; ++i) { int u,v; cin >> u >> v; G[u].push_back(v); G[v].push_back(u); } for(int i = 1; i <= N; ++i) { vector vec; int ans = 0; for(int v : G[i]) vec.push_back(v); for(int v : vec) ans += G[v].size()-1; cout << ans << endl; } }