#include <bits/stdc++.h>
using namespace std;
int n, a, b, g;
int res[1000007];
struct wierzch {
  list<int> l;
};
wierzch tab[1000007];
int gcd(int a, int b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
int testuj(int nr, int o, int k) {
  int d = 0;
  for (auto el : tab[nr].l)
    if (el != o) {
      int x = testuj(el, nr, k);
      if (x == -1) return -1;
      d += x;
    }
  if (d % k == 0) {
    g = gcd(d, g);
    return 1;
  }
  if ((d + 1) % k == 0) {
    g = gcd(d + 1, g);
    return 0;
  }
  return -1;
}
int solve() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) tab[i].l.clear();
  for (int i = 0; i < n - 1; i++) {
    scanf("%d %d", &a, &b);
    tab[a].l.push_back(b);
    tab[b].l.push_back(a);
  }
  int r = 1;
  for (int i = 0; i < n - 1; i++) r = r * 2 % 998244353;
  for (int k = 2; k <= n; k++) {
    g = 0;
    if ((n - 1) % k == 0 && testuj(1, 1, k) == 1 && g == k)
      res[k] = 1;
    else
      res[k] = 0;
    r -= res[k];
  }
  res[1] = (r + 998244353) % 998244353;
  for (int i = 1; i <= n; i++) printf("%d ", res[i]);
  printf("\n");
  return 0;
}
int main() {
  int _tests;
  scanf("%d", &_tests);
  for (int _test = 1; _test <= _tests; _test++) solve();
  return 0;
}
