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)

#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <map>
//#define ivorysi
#define pb push_back
#define space putchar(' ')
#define enter putchar('\n')
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define mo 974711
#define RG register
#define MAXN 200005
using namespace std;
typedef long long int64;
typedef double db;
template<class T>
void read(T &res) {
    res = 0;char c = getchar();T f = 1;
    while(c < '0' || c > '9') {
	if(c == '-') f = -1;
	c = getchar();
    }
    while(c >= '0' && c <= '9') {
	res = res * 10 + c - '0';
	c = getchar();
    }
    res *= f;
}
template<class T>
void out(T x) {
    if(x < 0) {putchar('-');x = -x;}
    if(x >= 10) {
	out(x / 10);
    }
    putchar('0' + x % 10);
}
struct node {
    int to,next;
}E[MAXN * 2];
int head[MAXN],sumE;
void add(int u,int v) {
    E[++sumE].to = v;
    E[sumE].next = head[u];
    head[u] = sumE;
}
const int MOD = 924844033,L = (1 << 19),G = 5;
int N,f[L + 5],fac[MAXN],invfac[MAXN],b[L + 5],W[L + 5];
int mul(int a,int b) {return 1LL * a * b % MOD;}
int inc(int a,int b) {a = a + b;if(a >= MOD) a -= MOD;return a;}
int fpow(int x,int c) {
    int t = x,res = 1;
    while(c) {
	if(c & 1) res = mul(res,t);
	t = mul(t,t);
	c >>= 1;
    }
    return res;
}
int C(int n,int m) {
    if(n < m) return 0;
    return mul(mul(fac[n],invfac[m]),invfac[n - m]);
}
int dfs(int u,int fa) {
    int siz = 1;
    for(int i = head[u] ; i ; i = E[i].next) {
	int v = E[i].to;
	if(v != fa) {
	    siz += dfs(v,u);
	}
    }
    if(fa != 0) {
	b[siz]++;
	b[N - siz]++;
    }
    return siz;
}
void NTT(int *a,int LEN,int on) {
    for(int i = 1 , j = LEN / 2 ; i < LEN - 1 ; ++i) {
	if(i < j) swap(a[i],a[j]);
	int k = LEN / 2;
	while(j >= k) {
	    j -= k;
	    k >>= 1;
	}
	j += k;
    }
    for(int h = 2 ; h <= LEN ; h <<= 1) {
	int wn = W[(L + on * L / h) % L];
	for(int k = 0 ; k < LEN ; k += h) {
	    int w = 1;
	    for(int j = k ; j < k + h / 2 ; ++j) {
		int64 u = a[j],t = 1LL * a[j + h / 2] * w;
		a[j] = (u + t) % MOD;
		a[j + h / 2] = (u - t + 1LL * MOD * MOD) % MOD;
		w = mul(w,wn);
	    }
	}
    }
    if(on == -1) {
	int invL = fpow(LEN,MOD - 2);
	for(int i = 0 ; i < LEN ; ++i) a[i] = mul(a[i],invL);
    }
}
void Solve() {
    read(N);
    int u,v;
    for(int i = 1 ; i < N ; ++i) {
	read(u);read(v);add(u,v);add(v,u);
    }
    dfs(1,0);
    fac[0] = 1;
    for(int i = 1 ; i <= N ; ++i) fac[i] = mul(fac[i - 1],i);
    invfac[N] = fpow(fac[N],MOD - 2);
    for(int i = N - 1 ; i >= 0 ; --i) invfac[i] = mul(invfac[i + 1],i + 1);
    for(int i = 0 ; i <= N ; ++i) f[N - i] = invfac[i];
    for(int i = 1 ; i <= N ; ++i) b[i] = mul(b[i],fac[i]);
    W[0] = 1;W[1] = fpow(G,(MOD - 1) / L);
    for(int i = 2 ; i < L ; ++i) W[i] = mul(W[i - 1],W[1]);
    int t = 1;
    while(t <= 2 * N) t <<= 1;
    NTT(b,t,1);NTT(f,t,1);
    for(int i = 0 ; i < t ; ++i) f[i] = mul(f[i],b[i]);
    NTT(f,t,-1);
    for(int i = 1 ; i <= N ; ++i) {
	int ans = mul(f[i + N],invfac[i]);
	ans = inc(mul(N,C(N,i)),MOD - ans);
	out(ans);enter;
    }
}
int main() {
#ifdef ivorysi
    freopen("f1.in","r",stdin);
#endif
    Solve();
    return 0;
}