#include using namespace std; int main() { int N; cin >> N; vector seen(N + 1); vector Ans(N + 1); vector> Graph(N + 1); for (int i = 0; i < N - 1; i++) { int u, v; cin >> u >> v; Graph.at(u).push_back(v); Graph.at(v).push_back(u); } auto DFS = [&](auto DFS, int s, int x, int c) -> void { if (c == 0) { Ans.at(s)++; return; } seen.at(x) = true; for (int to : Graph.at(x)) { if (seen.at(to)) continue; DFS(DFS, s, to, c - 1); } seen.at(x) = false; }; for (int i = 1; i <= N; i++) DFS(DFS, i, i, 2); for (int i = 1; i <= N; i++) cout << Ans.at(i) << endl; }