#include <bits/stdc++.h>
using namespace std;
vector<long long> a;
bool valido;
vector<vector<long long>> adj;
long long d;
void dfs(long long u, long long p = 0) {
  if (!valido) return;
  for (long long v : adj[u])
    if (v != p) dfs(v, u);
  if (a[u] % d == 0) {
    a[p]++;
  } else {
    a[u]++;
    if (p == 0 || a[u] % d != 0) valido = 0;
  }
}
int32_t main() {
  long long t;
  cin >> t;
  while (t--) {
    long long n;
    cin >> n;
    a.resize(n + 1);
    adj = vector<vector<long long>>(n + 1);
    for (long long i = 0; i < n - 1; i++) {
      long long a, b;
      cin >> a >> b;
      adj[a].push_back(b);
      adj[b].push_back(a);
    }
    vector<long long> freq(n + 1);
    freq[1] = 2;
    for (long long i = 1; i < n - 1; i++) freq[1] = 2 * freq[1] % 998244353;
    for (d = 2; d <= n - 1; d++) {
      if ((n - 1) % d == 0) {
        valido = 1;
        fill(a.begin(), a.end(), 0);
        dfs(1);
        freq[d] = valido;
      }
    }
    vector<long long> res(n + 1);
    for (long long d = n; d >= 1; d--) {
      res[d] = freq[d];
      for (long long mult = 2 * d; mult <= n; mult += d) {
        res[d] = res[d] - res[mult] + 998244353;
        res[d] %= 998244353;
      }
    }
    for (long long d = 1; d <= n; d++) {
      cout << res[d] << ' ';
    }
    cout << endl;
  }
  return 0;
}
