#pragma GCC optimize("O3,unroll-loops") #pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt") #include #include using namespace std; using namespace atcoder; using ll = long long; using mint = modint998244353; using fps = vector; #define endl '\n' #define rep(i,a,b) for(int i=(a);i<(b);i++) #define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--) fps mul(const fps &a, const fps &b, int n){ if(a.empty() || b.empty()){ return fps(n, mint(0)); } fps c = convolution(a, b); if((int)c.size() > n){ c.resize(n); } else{ c.resize(n, mint(0)); } return c; } fps inv_fps(const fps &f, int n){ fps g(1); g[0] = f[0].inv(); int m = 1; while(m < n){ int nm = min(2 * m, n); fps fcut(nm, mint(0)); rep(i,0,min((int)f.size(), nm)){ fcut[i] = f[i]; } fps t = mul(fcut, g, nm); rep(i,0,nm){ t[i] = -t[i]; } t[0] += mint(2); g = mul(g, t, nm); m = nm; } return g; } int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); int N; cin >> N; int L = N + 1; vector fact(N + 1), ifact(N + 1); fact[0] = 1; rep(i,1,N+1){ fact[i] = fact[i - 1] * i; } ifact[N] = fact[N].inv(); rrep(i,1,N+1){ ifact[i - 1] = ifact[i] * i; } /* P(x) = sum_{n>=1} n^{n-1} x^n/n! 根付きラベル付き木の EGF */ fps P(L, mint(0)); rep(i,1,N+1){ P[i] = mint(i).pow(i - 1) * ifact[i]; } fps P2 = mul(P, P, L); fps P3 = mul(P2, P, L); fps P4 = mul(P2, P2, L); /* Q(x) = e^P * P(1+P)(12-6P-4P^2+7P^3-3P^4) / (12(1-P)^3) ただし e^P = P/x なので、 Q(x) = A(x)/x A(x)=P^2(1+P)(12-6P-4P^2+7P^3-3P^4)/(12(1-P)^3) g(1) = (N-1)! [x^{N-1}] Q(x) = (N-1)! [x^N] A(x) */ fps S(L, mint(0)); S[0] = 12; rep(i,0,L){ S[i] -= mint(6) * P[i]; S[i] -= mint(4) * P2[i]; S[i] += mint(7) * P3[i]; S[i] -= mint(3) * P4[i]; } fps one_plus_P = P; one_plus_P[0] += 1; fps A = mul(P2, one_plus_P, L); A = mul(A, S, L); fps one_minus_P(L, mint(0)); one_minus_P[0] = 1; rep(i,0,L){ one_minus_P[i] -= P[i]; } fps inv1 = inv_fps(one_minus_P, L); fps inv2 = mul(inv1, inv1, L); fps inv3 = mul(inv2, inv1, L); A = mul(A, inv3, L); mint inv12 = mint(12).inv(); rep(i,0,L){ A[i] *= inv12; } mint g1 = fact[N - 1] * A[N]; /* g(M) = g(1) - D(M-1)(N-M) D = (7N-12)N^{N-5} ただし小さい N は個別処理 */ mint D = 0; if(N <= 2){ D = 0; } else if(N == 3){ D = 1; } else if(N == 4){ D = 4; } else{ D = mint(7LL * N - 12) * mint(N).pow(N - 5); } rep(M,1,N+1){ mint ans = g1 - D * mint(M - 1) * mint(N - M); cout << ans.val() << endl; } return 0; }