#if defined(local) #include "./noya/debug.hpp" #else #define debug(...) 42 #endif #include "bits/stdc++.h" using namespace std; #define rep1(a) for (int i = 0; i < a; i++) #define rep2(i, a) for (int i = 0; i < a; i++) #define rep3(i, a, b) for (int i = a; i < b; i++) #define rep4(i, a, b, c) for (int i = a; i < b; i += c) #define overload4(a, b, c, d, e, ...) e #define rep(...) overload4(__VA_ARGS__, rep4, rep3, rep2, rep1)(__VA_ARGS__) #define pb emplace_back template void cmin(T &x, const T2 &y) { x = x < y ? x : y; } template void cmax(T &x, const T2 &y) { x = x > y ? x : y; } #include using ll = int64_t; using ull = uint64_t; namespace noya { template constexpr T infty = 0; template <> constexpr int infty = 1010000000; template <> constexpr ll infty = 2020000000000000000; template <> constexpr unsigned infty = infty; template <> constexpr ull infty = infty; template <> constexpr __int128 infty<__int128> = __int128(infty) * 2000000000000000000; template <> constexpr double infty = infty; template <> constexpr long double infty = infty; } // namespace noya using vi = vector; using vl = vector; using pii = pair; using pll = pair; template using vc = vector; const int INF = 1010000000; const ll LNF = 2020000000000000000; #define sz(x) int((x).size()) #define all(x) begin(x), end(x) #define fi first #define se second namespace noya {} mt19937 rng(time(NULL)); using namespace noya; void solve() { int N; cin >> N; vc g(N); rep(N - 1) { int a, b; cin >> a >> b; a--; b--; g[a].pb(b); g[b].pb(a); } rep(u, N) { ll ans = 0; for (auto v : g[u]) ans += sz(g[v]) - 1; cout<> t; while (t--) { solve(); } return 0; }