Problem: Note that the only differences between easy and hard versions are the constraints on n and the time limit. You can make hacks only if all versions are solved.

Slime is interested in sequences. He defined good positive integer sequences p of length n as follows:

  * For each k>1 that presents in p, there should be at least one pair of indices i,j, such that 1 ≤ i < j ≤ n, p_i = k - 1 and p_j = k.



For the given integer n, the set of all good sequences of length n is s_n. For the fixed integer k and the sequence p, let f_p(k) be the number of times that k appears in p. For each k from 1 to n, Slime wants to know the following value:

$$$\left(∑_{p∈ s_n} f_p(k)\right)\ mod\ 998 244 353$$$

Input

The first line contains one integer n\ (1≤ n≤ 5000).

Output

Print n integers, the i-th of them should be equal to \left(∑_{p∈ s_n} f_p(i)\right)\ mod\ 998 244 353.

Examples

Input


2


Output


3 1 


Input


3


Output


10 7 1 


Input


1


Output


1 

Note

In the first example, s=\{[1,1],[1,2]\}.

In the second example, s=\{[1,1,1],[1,1,2],[1,2,1],[1,2,2],[2,1,2],[1,2,3]\}.

In the third example, s=\{[1]\}.

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int x = 0;
  bool flg = false;
  char ch = getchar();
  for (; !isdigit(ch); ch = getchar())
    if (ch == '-') flg = true;
  for (; isdigit(ch); ch = getchar()) x = (x << 3) + (x << 1) + (ch ^ 48);
  return flg ? -x : x;
}
void print(int x) {
  if (x > 9) print(x / 10);
  putchar((x % 10) ^ 48);
}
const int Mod = 998244353, g = 3, inv2 = Mod + 1 >> 1;
inline int qpow(int x, int y) {
  int res = 1;
  for (; y; y >>= 1, x = 1LL * x * x % Mod)
    if (y & 1) res = 1LL * res * x % Mod;
  return res;
}
inline int upd(int x) { return x + (x >> 31 & Mod); }
int fac[100100], ifac[100100], inv[100100];
int n;
namespace NTT {
const int X = 1 << 18;
int Wn[X | 1], W, imaxw[40];
void prepare(int len) {
  imaxw[0] = 1;
  for (int i = 1; i <= 30; i++) imaxw[i] = 1LL * imaxw[i - 1] * inv2 % Mod;
  for (W = 1; W <= len; W <<= 1)
    ;
  Wn[0] = 1;
  for (int i = 1, t = qpow(g, (Mod - 1) / W); i <= W; i++)
    Wn[i] = 1LL * Wn[i - 1] * t % Mod;
}
int id[X], maxw, btw;
void init(int len, bool tp = 1) {
  for (maxw = 1, btw = 0; maxw <= len; maxw <<= 1, btw++)
    ;
  if (tp)
    for (int i = 1, t = btw - 1; i < maxw; i++)
      id[i] = (id[i >> 1] >> 1) | ((i & 1) << t);
}
void ntt(int *w, int tp) {
  for (int i = 0; i < maxw; i++)
    if (i < id[i]) swap(w[i], w[id[i]]);
  for (int midlen = 1, len = 2; midlen < maxw; midlen = len, len <<= 1)
    for (int l = 0, stp = W / len * tp; l < maxw; l += len)
      for (int u = l, cur = ~tp ? 0 : W, x, y; u - l < midlen;
           u++, cur += stp) {
        x = w[u], y = 1LL * Wn[cur] * w[u + midlen] % Mod;
        w[u] = upd(x + y - Mod);
        w[u + midlen] = upd(x - y);
      }
}
void getinv(int n, int *f, int *g) {
  static int h[X];
  if (!n) return g[0] = qpow(f[0], Mod - 2), void();
  getinv(n >> 1, f, g);
  init(n << 1);
  for (int i = 0; i <= n; i++) h[i] = f[i];
  for (int i = n + 1; i < maxw; i++) h[i] = 0;
  ntt(g, 1);
  ntt(h, 1);
  for (int i = 0; i < maxw; i++)
    g[i] = upd((2 - 1LL * g[i] * h[i]) % Mod * g[i] % Mod);
  ntt(g, -1);
  for (int i = 0; i <= n; i++) g[i] = 1LL * g[i] * imaxw[btw] % Mod;
  for (int i = n + 1; i < maxw; i++) g[i] = 0;
}
void getln(int n, int *f, int *g) {
  static int h[X];
  if (!n) return g[0] = 0, void();
  getinv(n - 1, f, g);
  init(n - 1 << 1);
  for (int i = 0; i < n; i++) h[i] = 1LL * f[i + 1] * (i + 1) % Mod;
  for (int i = n; i < maxw; i++) h[i] = 0;
  ntt(g, 1);
  ntt(h, 1);
  for (int i = 0; i < maxw; i++) g[i] = 1LL * g[i] * h[i] % Mod;
  ntt(g, -1);
  for (int i = n; i; i--)
    g[i] = 1LL * g[i - 1] * imaxw[btw] % Mod * inv[i] % Mod;
  g[0] = 0;
  for (int i = n + 1; i < maxw; i++) g[i] = 0;
}
void getexp(int l, int r, int *f, int *g) {
  static int A[X], B[X];
  if (l == r) {
    g[l] = l ? 1LL * g[l] * inv[l] % Mod : 1;
    return;
  }
  int mid = l + r >> 1;
  getexp(l, mid, f, g);
  init(r - l);
  for (int i = l; i <= mid; i++) A[i - l] = g[i];
  for (int i = mid - l + 1; i < maxw; i++) A[i] = 0;
  for (int i = 0, t = r - l; i <= t; i++) B[i] = f[i];
  for (int i = r - l + 1; i < maxw; i++) B[i] = 0;
  ntt(A, 1);
  ntt(B, 1);
  for (int i = 0; i < maxw; i++) A[i] = 1LL * A[i] * B[i] % Mod;
  ntt(A, -1);
  for (int i = mid + 1; i <= r; i++)
    g[i] = (g[i] + 1LL * A[i - l] * imaxw[btw]) % Mod;
  getexp(mid + 1, r, f, g);
}
}  // namespace NTT
using namespace NTT;
int M[X], N[X], Q[X], R[X], S[X], T[X], U[X], V[X], A[X], B[X], C[X], D[X],
    E[X];
int H[X], HH[X], F[X];
int dp[100010];
int main() {
  n = read();
  int W = n + 15, m;
  prepare(W << 1);
  fac[0] = 1;
  for (int i = 1; i <= W; i++) fac[i] = 1LL * fac[i - 1] * i % Mod;
  ifac[W] = qpow(fac[W], Mod - 2);
  for (int i = W; i; i--) ifac[i - 1] = 1LL * ifac[i] * i % Mod;
  inv[1] = 1;
  for (int i = 2; i <= W; i++)
    inv[i] = 1LL * (Mod - Mod / i) * inv[Mod % i] % Mod;
  M[0] = M[1] = 1;
  m = n + 10;
  getln(m, M, N);
  for (int i = 0; i < m; i++) N[i] = N[i + 1];
  N[m] = 0;
  getinv(m, N, H);
  getln(m, H, S);
  for (int i = 0; i <= m; i++) S[i] = 1LL * S[i] * (n + 1) % Mod * i % Mod;
  getexp(0, m, S, T);
  for (int i = 0; i < m; i++) HH[i] = 1LL * H[i + 1] * (i + 1) % Mod;
  for (int i = 0; i < m; i++) Q[i] = upd(-H[i + 1]);
  getinv(m, Q, R);
  init(m << 1);
  ntt(R, 1);
  ntt(T, 1);
  for (int i = 0; i < maxw; i++) U[i] = 1LL * R[i] * T[i] % Mod;
  ntt(U, -1);
  for (int i = 0; i <= m; i++) V[i] = U[i] = 1LL * U[i] * imaxw[btw] % Mod;
  for (int i = m + 1; i < maxw; i++) U[i] = 0;
  ntt(V, 1);
  ntt(HH, 1);
  for (int i = 0; i < maxw; i++) V[i] = 1LL * V[i] * HH[i] % Mod;
  ntt(V, -1);
  for (int i = 0; i <= m; i++) V[i] = 1LL * V[i] * imaxw[btw] % Mod;
  for (int i = m + 1; i < maxw; i++) V[i] = 0;
  ntt(V, 1);
  for (int i = 0; i < maxw; i++) V[i] = 1LL * V[i] * R[i] % Mod;
  ntt(V, -1);
  for (int i = 0; i <= m; i++) V[i] = 1LL * V[i] * imaxw[btw] % Mod;
  for (int i = m + 1; i < maxw; i++) V[i] = 0;
  for (int i = 0; i <= m; i++) F[i] = ifac[i + 1];
  for (int i = 0; i < m; i++) A[i] = upd(-F[i + 1]);
  getinv(m, A, B);
  for (int i = 0; i < n; i++) {
    int k = n - i + 1;
    dp[i] = 1LL * k * U[n - k + 2] % Mod;
    dp[i] = upd(dp[i] + V[n - k + 2] - Mod);
    dp[i] = 1LL * dp[i] * inv[n + 1] % Mod;
    dp[i] = upd(-dp[i]);
    dp[i] = upd(dp[i] + B[i + 1] - Mod);
    if (!i) dp[i] = upd(dp[i] - 1);
  }
  for (int i = 0; i < n; i++) {
    C[n - 1 - i] = 1LL * fac[i] * dp[i] % Mod;
    D[i] = 1LL * (i & 1 ? Mod - 1 : 1) * ifac[i] % Mod;
  }
  ntt(C, 1);
  ntt(D, 1);
  for (int i = 0; i < maxw; i++) E[i] = 1LL * C[i] * D[i] % Mod;
  ntt(E, -1);
  reverse(E, E + n);
  for (int i = 0; i < n; i++) {
    int ans = 1LL * fac[n] * ifac[i] % Mod * E[i] % Mod * imaxw[btw] % Mod;
    print(ans);
    putchar(' ');
  }
  putchar('\n');
  return 0;
}