#include using namespace std; using ll = long long; #define rep(i, s, e) for (int i = (int)s; i < (int)e; ++i) #define all(a) (a).begin(),(a).end() int main() { cin.tie(nullptr); int N; cin >> N; vector> G(N, vector()); rep(i, 0, N - 1) { int u, v; cin >> u >> v; u--, v--; G[u].push_back(v); G[v].push_back(u); } rep(i, 0, N) { int ans = 0; for (int next : G[i]) ans += G[next].size() - 1; cout << ans << '\n'; } }