func_code_string: #include <bits/stdc++.h>   using namespace std;   using lint = long long;   const int inf = 1000000007;   const int MOD = 1000000007;   void solve() {     int n, k;     cin >> n >> k;     vector<set<int>> edge(n);     for (int i = 0; i < n - 1; ++i) {       int a, b;       cin >> a >> b;       --a;       --b;       edge[a].insert(b);       edge[b].insert(a);     }     if (k == 1) {       cout << n - 1 <<   n ;       return;     }     int res = 0;     vector<queue<int>> child(n);     for (int i = 0; i < n; ++i) {       if (edge[i].size() == 1) {         child[*edge[i].begin()].push(i);       }     }     queue<int> que;     for (int i = 0; i < n; ++i) {       if (child[i].size() >= k) que.push(i);     }     while (!que.empty()) {       int x = que.front();       que.pop();       if (child[x].size() < k) continue;       res += 1;       for (int i = 0; i < k; ++i) {         int buf = child[x].front();         child[x].pop();         edge[x].erase(buf);       }       if (child[x].size() >= k) que.push(x);       if (edge[x].size() == 1) {         int par = *edge[x].begin();         child[par].push(x);         if (child[par].size() >= k) que.push(par);       }     }     cout << res <<   n ;   }   signed main() {     cin.tie(0);     ios::sync_with_stdio(false);     int t;     cin >> t;     for (int i = 0; i < t; ++i) solve();     return 0;   }   