Problem:
Score : 1900 points

Problem Statement

#nck {
width: 30px;
height: auto;
}

One day, Takahashi was given the following problem from Aoki:

You are given a tree with N vertices and an integer K. The vertices are numbered 1 through N. The edges are represented by pairs of integers (a_i, b_i).

For a set S of vertices in the tree, let f(S) be the minimum number of the vertices in a subtree of the given tree that contains all vertices in S.

There are ways to choose K vertices from the trees. For each of them, let S be the set of the chosen vertices, and find the sum of f(S) over all ways.

Since the answer may be extremely large, print it modulo 924844033(prime).

Since it was too easy for him, he decided to solve this problem for all K = 1,2,...,N.

Constraints

2 ≦ N ≦ 200,000

1 ≦ a_i, b_i ≦ N

The given graph is a tree.

Input

The input is given from Standard Input in the following format:

N
a_1 b_1
a_2 b_2
:
a_{N-1} b_{N-1}

Output

Print N lines. The i-th line should contain the answer to the problem where K=i, modulo 924844033.

Sample Input 1

3
1 2
2 3

Sample Output 1

3
7
3

The diagram above illustrates the case where K=2. The chosen vertices are colored pink, and the subtrees with the minimum number of vertices are enclosed by red lines.

Sample Input 2

4
1 2
1 3
1 4

Sample Output 2

4
15
13
4

Sample Input 3

7
1 2
2 3
2 4
4 5
4 6
6 7

Sample Output 3

7
67
150
179
122
45
7

Solution in C++14 (GCC 5.4.1) (judge verdict: Accepted)

// =================================
//   author: memset0
//   date: 2019.01.25 22:26:04
//   website: https://memset0.cn/
// =================================
#include <bits/stdc++.h>
#define ll long long
namespace ringo {
template <class T> inline void read(T &x) {
	x = 0; register char c = getchar(); register bool f = 0;
	while (!isdigit(c)) f ^= c == '-', c = getchar();
	while (isdigit(c)) x = x * 10 + c - '0', c = getchar();
	if (f) x = -x;
}
template <class T> inline void print(T x) {
	if (x < 0) putchar('-'), x = -x;
	if (x > 9) print(x / 10);
	putchar('0' + x % 10);
}
template <class T> inline void print(T x, char c) { print(x), putchar(c); }

const int N = 2e5 + 10, mod = 924844033;
int n, k, lim = 1, inv_lim;
int f[N << 2], g[N << 2], w[N << 2], rev[N << 2];;
int cnt[N], fac[N], fac_inv[N], fa[N], siz[N], ans[N];
int tot = 2, hed[N], to[N << 1], nxt[N << 1];

inline int C(int n, int m) { return (ll)fac[n] * fac_inv[m] % mod * fac_inv[n - m] % mod; }
inline int inv(int x) { return !x || x == 1 ? 1 : (ll)(mod - mod / x) * inv(mod % x) % mod; }
inline int fpow(int a, int b) {
    int s = 1;
    for (; b; b >>= 1, a = (ll)a * a % mod)
        if (b & 1) s = (ll)s * a % mod;
    return s;
}

void ntt(int *a, int lim) {
    for (int i = 0; i < lim; i++) if (i < rev[i]) std::swap(a[i], a[rev[i]]);
    for (int len = 1; len < lim; len <<= 1)
        for (int i = 0; i < lim; i += (len << 1))
            for (int j = 0; j < len; j++) {
                int x = a[i + j], y = (ll)w[j + len] * a[i + j + len] % mod;
                a[i + j] = (x + y) % mod, a[i + j + len] = (x - y + mod) % mod;
            }
}

void dfs(int u) {
    siz[u] = 1;
    for (int i = hed[u], v = to[i]; i; i = nxt[i], v = to[i])
        if (v != fa[u]) {
            fa[v] = u, dfs(v), siz[u] += siz[v];
        }
    ++cnt[n - siz[u]];
    if (u != 1) ++cnt[siz[u]];
}

void main() {
    read(n), fac[0] = fac[1] = fac_inv[0] = fac_inv[1] = 1;
    for (int i = 2; i <= n; i++) fac[i] = (ll)fac[i - 1] * i % mod;
    for (int i = 2; i <= n; i++) fac_inv[i] = inv(fac[i]);
    for (int i = 1, u, v; i < n; i++) {
        read(u), read(v);
        nxt[tot] = hed[u], to[tot] = v, hed[u] = tot++;
        nxt[tot] = hed[v], to[tot] = u, hed[v] = tot++;
    } dfs(1);

    while (lim <= (n + 1 + n + 1)) lim <<= 1, ++k;
    for (int i = 0; i < lim; i++) rev[i] = (rev[i >> 1] >> 1) | ((i & 1) << (k - 1));
    for (int len = 1, wn; len < lim; len <<= 1) {
        wn = fpow(5, (mod - 1) / (len << 1)), w[len] = 1;
        for (int i = 1; i < len; i++) w[i + len] = (ll)w[i + len - 1] * wn % mod;
    }
    for (int i = 0; i <= n; i++) f[i] = (ll)cnt[i] * fac[i] % mod;
    for (int i = 0; i <= n; i++) g[i] = fac_inv[n - i];
    // for (int i = 0; i < lim; i++) print(f[i], " \n"[i == lim - 1]);
    // for (int i = 0; i < lim; i++) print(g[i], " \n"[i == lim - 1]);
    ntt(f, lim), ntt(g, lim), inv_lim = inv(lim);
    for (int i = 0; i < lim; i++) f[i] = (ll)f[i] * g[i] % mod;
    std::reverse(f + 1, f + lim), ntt(f, lim);
    for (int i = 0; i < lim; i++) f[i] = (ll)f[i] * inv_lim % mod;
    // for (int i = 0; i < lim; i++) print(f[i], " \n"[i == lim - 1]);
    for (int i = 1; i <= n; i++) ans[i] = (ll)f[i + n] * fac_inv[i] % mod;
    for (int i = 1; i <= n; i++) ans[i] = ((ll)n * C(n, i) - ans[i] + mod) % mod;
    for (int i = 1; i <= n; i++) print(ans[i], " \n"[i == n]);
}

} signed main() { return ringo::main(), 0; }