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 <vector>
#include <algorithm>
#include <cstring>
using namespace std;
typedef long long LL;
const int N = 400000 + 10;
const int MOD = 924844033;
const int root = 44009197;   // root ^ (2^21) % MOD = 1
const int root_1 = 921713838; // root * root_1 = 1
const int root_pw = 1 << 21; // 998244353 = 119 * 2^23 + 1
LL mpow(LL a,LL x){
    if(x==0)return 1;
    LL t=mpow(a,x>>1);
    if(x%2==0)return t*t%MOD;
    return t*t%MOD*a%MOD;
}
LL modinv(LL a){
    LL x0=0,x1=1,r0=MOD,r1=a;
    while(r1){
        LL q=r0/r1;
        x0-=q*x1;swap(x0,x1);
        r0-=q*r1;swap(r0,r1);
    }
    return x0<0?x0+MOD:x0;
}
void fft(vector<int> &a, bool inv) { // a.size()不为2的幂会原地爆炸。
    int n=(int)a.size();
    // 迷 の butterfly操作
    for(int i=1,j=0;i<n;i++) {
        int bit=n>>1;
        for(;j>=bit;bit>>=1) j-=bit; j+=bit;   
        if(i<j)swap(a[i],a[j]);
    }
    // 施展 DFT
    for(int len=2;len<=n;len<<=1) {
        int wlen=inv?root_1:root;
        for(int i=len;i<root_pw;i<<=1) wlen=wlen*1LL*wlen%MOD;
        for(int i=0;i<n;i+=len) {
            int w=1;
            for(int j=0;j<len/2;j++) {
                int u=a[i+j],v=int(a[i+j+len/2]*1LL*w%MOD);
                a[i+j] = (u+v<MOD)?u+v:u+v-MOD;
                a[i+j+len/2] = (u-v>=0)?u-v:u-v+MOD;
                w = w*1LL*wlen%MOD;
            }
        }
    }
    if(inv) {
        int nrev = modinv(n);
        for(int i=0;i<n;i++) a[i]=a[i]*1LL*nrev%MOD;
    }
}
void pro(const vector<int> &a, const vector<int> &b, vector<int> &res) {
    vector<int> fa(a.begin(), a.end()),fb(b.begin(), b.end());
    int n=1; while (n<(int) max(a.size(), b.size())) n<<=1; n<<=1;
    fa.resize(n),fb.resize(n);
    fft(fa,false), fft(fb,false);
    for(int i=0;i<n;i++) fa[i] = 1LL*fa[i]*fb[i]%MOD;
    fft(fa,true);
    res = fa;
}
LL inv[N],fac[N];
void init() {
    inv[1]=1;
    for(int i=2;i<N;i++){
        inv[i]=1LL * (MOD-(MOD/i)) * inv[MOD%i] % MOD;
    }
    inv[0]=fac[0]=1;
    for(int i=1;i<N;i++){
        inv[i]=inv[i-1]*inv[i]%MOD;
        fac[i]=fac[i-1]*i%MOD;
    }
}

vector<int> g[N];
int n,sz[N];
void dfs(int u,int p) {
    sz[u]=1;
    for(auto v: g[u]) {
        if(v==p) continue;
        dfs(v,u);
        sz[u]+=sz[v];
    }
}
int c[N];
int comb(int x,int y){
    return 1LL * fac[x] * inv[y] % MOD * inv[x-y] % MOD;
}
int ans[N];
void getAns(vector<int> vec) {
    memset(c,0,sizeof(c));
    for(auto x: vec) c[x]++;
    vector<int> res;
    vector<int> p1, p2, p;
    p1.push_back(0);
    for(int i=1;i<n;i++){
        p1.push_back(1LL * c[i] * fac[i] % MOD);
    }
    for(int i=0;i<=n;i++){
        p2.push_back(inv[i]);
    }
    reverse(p2.begin(), p2.end());
    pro(p1,p2,p);
    for(int i=p2.size();i<p.size();i++){
        p[i] = p[i] * inv[i - (int)p2.size() + 1] % MOD;
        ans[i - (int)p2.size()] -= p[i];
        ans[i - (int)p2.size()] = ((ans[i - (int)p2.size()] % MOD) + MOD) % MOD;
    }
}
int main() {
    init();
    scanf("%d",&n);
    for(int i=1;i<n;i++) {
        int u,v;
        scanf("%d%d",&u,&v);
        g[u].push_back(v); g[v].push_back(u);
    }
    dfs(1,1);
    for(int i=0;i<n;i++) {
        ans[i] = 1LL * comb(n,i+1) * n % MOD;
    }
    vector<int> v; for(int i=1;i<=n;i++) v.push_back(sz[i]); getAns(v);
    v.clear();   for(int i=1;i<=n;i++) v.push_back(n-sz[i]); getAns(v);
    for(int i=0;i<n;i++)  printf("%d\n", ans[i]);
}