#ifndef MY_HEADER #define MY_HEADER #include #include using namespace std; using namespace atcoder; using lint = long long; using ulint = unsigned long long; using llint = __int128_t; struct edge; using graph = vector>; #define endl '\n' constexpr int INF = 1<<30; constexpr lint INF64 = 1LL<<61; constexpr lint mod107 = 1e9+7; using mint107 = modint1000000007; constexpr long mod = 998244353; using mint = modint998244353; lint ceilDiv(lint x, lint y){if(x >= 0){return (x+y-1)/y;}else{return x/y;}} lint floorDiv(lint x, lint y){if(x >= 0){return x/y;}else{return (x-y+1)/y;}} lint Sqrt(lint x) {assert(x >= 0); lint ans = sqrt(x); while(ans*ans > x)ans--; while((ans+1)*(ans+1)<=x)ans++; return ans;} lint gcd(lint a,lint b){if(a 0){int a = n%10;char b = '0' + a;string c = "";c += b;n /= 10;ans = c + ans;}}return ans;} string toString(lint n, lint k){string ans = toString(n);string tmp = "";while(ans.length() + tmp.length() < k){tmp += "0";}return tmp + ans;} vectorprime;void makePrime(lint n){prime.push_back(2);for(lint i=3;i<=n;i+=2){bool chk = true;for(lint j=0;j= 0; i--) #define vec vector #define pb push_back #define eb emplace_back #define se second #define fi first #define al(x) x.begin(),x.end() #define ral(x) x.rbegin(),x.rend() struct edge{ edge(lint v, lint c = 1) {to = v, cost = c;} lint to; lint cost; }; #endif vecfac(5001), ifac(5001); vecpow3(5001), ipow3(5001); mint ncr(int n, int r) { return fac[n] * ifac[r] * ifac[n-r]; } int main(){ lint N; cin >> N; fac[0] = 1; ifac[0] = 1; pow3[0] = 1; ipow3[0] = 1; rep(i, N) { fac[i+1] = fac[i]*(i+1); ifac[i+1] = ifac[i] / (i+1); pow3[i+1] = pow3[i] * 3; ipow3[i+1] = ipow3[i] / 3; } vecP(N+1); P[N] = 1; vecp0(N+1), ip0(N+1, 1); for(int i = N; i >= 2; i--) { p0[i] = 1; repp(j, 1, i) { p0[i] -= ncr(i, j) * ipow3[i-1]; } ip0[i] /= (1-p0[i]); repp(j, 1, i) { P[i-j] += P[i]* ncr(i, j) * ipow3[i-1] * ip0[i]; } } vecans(N+1); for(int i = N-1; i >= 1; i--) { for(int j = i+1; j <= N; j++){ ans[i] += P[j]*ip0[j]; } } rep(i, N) cout << ans[i+1].val() << " "; }