#include <bits/stdc++.h>
using namespace std;
const long long mod = 998244353;
vector<int> G[100020];
long long num[100010], dp[100010];
int falg;
long long qpow(long long a, long long b) {
  long long ans = 1;
  while (b) {
    if (b & 1) ans = ans * a % mod;
    a = a * a % mod;
    b >>= 1;
  }
  return ans;
}
void dfs(int x, int fa, int k) {
  if (falg == 1) return;
  for (int i = 0; i < G[x].size(); i++)
    if (G[x][i] != fa) dfs(G[x][i], x, k);
  if (dp[x] % k == 0)
    dp[fa]++;
  else {
    if (fa) dp[x]++;
    if (dp[x] % k != 0) falg = 1;
  }
  if (falg == 1) return;
}
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n, a, b;
    cin >> n;
    for (int i = (0); i < (n + 1); ++i) G[i].clear(), num[i] = dp[i] = 0;
    for (int i = (0); i < (n - 1); ++i) {
      scanf("%d%d", &a, &b);
      G[a].push_back(b);
      G[b].push_back(a);
    }
    num[1] = qpow(2, n - 1);
    for (int i = (2); i < (n); ++i) {
      if ((n - 1) % i == 0) {
        falg = 0;
        dfs(1, 0, i);
        num[i] = 1 - falg;
        for (int i = (0); i < (n + 1); ++i) dp[i] = 0;
      }
    }
    for (int i = n; i >= 1; i--)
      for (int j = 2 * i; j <= n; j += i) num[i] -= num[j];
    for (int i = (1); i < (n + 1); ++i) cout << (num[i] + mod) % mod << ' ';
    cout << '\n';
  }
}
