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;
long long pow_mod(long long x, int k) {
  long long ans = 1;
  while (k) {
    if (k & 1) ans = ans * x % 998244353;
    x = x * x % 998244353;
    k >>= 1;
  }
  return ans;
}
long long facd[200005], facv[200005], inv[200005];
void pre(int n) {
  facd[0] = 1;
  for (int i = 1; i <= n; i++) facd[i] = facd[i - 1] * i % 998244353;
  facv[n] = pow_mod(facd[n], 998244353 - 2);
  for (int i = n - 1; i >= 0; i--) facv[i] = facv[i + 1] * (i + 1) % 998244353;
  inv[1] = 1;
  for (int i = 2; i <= n; i++)
    inv[i] = (998244353 - 998244353 / i) * inv[998244353 % i] % 998244353;
}
inline long long C(int n, int m) {
  return (n < m) ? 0 : facd[n] * facv[m] % 998244353 * facv[n - m] % 998244353;
}
const int Maxn = 1 << 18;
long long *w[18];
void ntt_init() {
  for (int i = 2, t = 0; i <= Maxn; i <<= 1, t++) {
    w[t] = new long long[i >> 1];
    long long wn = pow_mod(3, (998244353 - 1) / i);
    w[t][0] = 1;
    for (int j = 1; j < (i >> 1); j++) w[t][j] = w[t][j - 1] * wn % 998244353;
  }
}
void rev(long long *p, int len) {
  int j = len >> 1;
  for (int i = 1; i < len - 1; i++) {
    if (i < j) swap(p[i], p[j]);
    int k = len >> 1;
    while (j >= k) {
      j -= k;
      k >>= 1;
    }
    if (j < k) j += k;
  }
}
void ntt(long long *p, int len, int check) {
  rev(p, len);
  for (int i = 2, t = 0; i <= len; i <<= 1, t++)
    for (int j = 0; j < len; j += i)
      for (int k = j; k < j + (i >> 1); k++) {
        long long u = p[k];
        long long v = w[t][k - j] * p[k + (i >> 1)];
        p[k] = (u + v) % 998244353;
        p[k + (i >> 1)] = (u - v) % 998244353;
      }
  if (check == -1) {
    reverse(p + 1, p + len);
    long long nev = pow_mod(len, 998244353 - 2);
    for (int i = 0; i < len; i++) p[i] = (p[i] + 998244353) * nev % 998244353;
  }
}
void getinv(long long *p, long long *q, int len) {
  static long long t1[Maxn];
  if (len == 1) {
    q[0] = pow_mod(p[0], 998244353 - 2);
    return;
  }
  getinv(p, q, len >> 1);
  memcpy(t1, p, sizeof(long long) * len);
  memset(t1 + len, 0, sizeof(long long) * len);
  ntt(q, len << 1, 1);
  ntt(t1, len << 1, 1);
  for (int i = 0; i < (len << 1); i++)
    q[i] = q[i] * (2LL - q[i] * t1[i] % 998244353) % 998244353;
  ntt(q, len << 1, -1);
  memset(q + len, 0, sizeof(long long) * len);
}
void getdif(long long *p, long long *q, int len) {
  for (int i = 0; i < len - 1; i++) q[i] = p[i + 1] * (i + 1) % 998244353;
  q[len - 1] = 0;
}
void getint(long long *p, long long *q, int len) {
  for (int i = len - 1; i > 0; i--) q[i] = p[i - 1] * inv[i] % 998244353;
  q[0] = 0;
}
void getln(long long *p, long long *q, int len) {
  static long long t1[Maxn];
  getdif(p, q, len);
  memset(t1, 0, sizeof(long long) * (len << 1));
  getinv(p, t1, len);
  ntt(q, len << 1, 1);
  ntt(t1, len << 1, 1);
  for (int i = 0; i < (len << 1); i++) q[i] = q[i] * t1[i] % 998244353;
  ntt(q, len << 1, -1);
  getint(q, q, len);
  memset(q + len, 0, sizeof(long long) * len);
}
void getexp(long long *p, long long *q, int len) {
  static long long t1[Maxn];
  if (len == 1) {
    q[0] = 1;
    return;
  }
  getexp(p, q, len >> 1);
  memset(t1, 0, sizeof(long long) * (len << 1));
  getln(q, t1, len);
  for (int i = 0; i < len; i++) t1[i] = (p[i] - t1[i] + 998244353) % 998244353;
  t1[0] = (t1[0] + 1LL) % 998244353;
  ntt(q, len << 1, 1);
  ntt(t1, len << 1, 1);
  for (int i = 0; i < (len << 1); i++) q[i] = q[i] * t1[i] % 998244353;
  ntt(q, len << 1, -1);
  memset(q + len, 0, sizeof(long long) * len);
}
long long ans[Maxn];
long long p[Maxn], q[Maxn];
void solve1(int n) {
  static long long t1[Maxn], t2[Maxn];
  int len = 1;
  while (len < n + 5) len <<= 1;
  memset(p, 0, sizeof(long long) * (len << 1));
  memset(q, 0, sizeof(long long) * (len << 1));
  memset(t1, 0, sizeof(long long) * (len << 1));
  memset(t2, 0, sizeof(long long) * (len << 1));
  for (int i = 1; i <= n + 4; i++) t1[i] = inv[i];
  t1[0] = 1;
  for (int i = n + 4; i > 0; i--)
    t1[i] = (t1[i - 1] - t1[i] + 998244353) % 998244353;
  for (int i = 0; i <= n + 2; i++) t1[i] = t1[i + 2];
  t1[n + 3] = t1[n + 4] = 0;
  getinv(t1, t2, len);
  memset(t1, 0, sizeof(long long) * (len << 1));
  for (int i = 1; i <= n + 4; i++) t1[i] = (998244353 - inv[i]) % 998244353;
  ntt(t1, len << 1, 1);
  for (int i = 0; i < (len << 1); i++) t1[i] = t1[i] * t1[i] % 998244353;
  ntt(t1, len << 1, -1);
  for (int i = n + 5; i < (len << 1); i++) t1[i] = 0;
  for (int i = n + 4; i > 0; i--)
    t1[i] = (t1[i - 1] - t1[i] + 998244353) % 998244353;
  for (int i = 0; i <= n + 2; i++) t1[i] = t1[i + 2];
  t1[n + 3] = t1[n + 4] = 0;
  ntt(t1, len << 1, 1);
  ntt(t2, len << 1, 1);
  for (int i = 0; i < (len << 1); i++) p[i] = t1[i] * t2[i] % 998244353;
  ntt(p, len << 1, -1);
  for (int i = n + 3; i < (len << 1); i++) p[i] = 0;
  memset(t1, 0, sizeof(long long) * (len << 1));
  memset(t2, 0, sizeof(long long) * (len << 1));
  for (int i = 0; i <= n + 1; i++) t1[i] = inv[i + 1];
  getln(t1, t2, len);
  for (int i = 0; i < len; i++) t2[i] = t2[i] * (998244353 - n - 2) % 998244353;
  getexp(t2, q, len);
  if (n & 1) {
    for (int i = 0; i <= n + 1; i++) q[i] = (998244353 - q[i]) % 998244353;
  }
  for (int i = n + 2; i < len; i++) q[i] = 0;
  memset(t1, 0, sizeof(long long) * (len << 1));
  memset(t2, 0, sizeof(long long) * (len << 1));
  getdif(p, t1, n + 3);
  for (int i = 0; i <= n + 1; i++) t2[i] = q[i];
  ntt(t1, len << 1, 1);
  ntt(t2, len << 1, 1);
  for (int i = 0; i < (len << 1); i++) t1[i] = t1[i] * t2[i] % 998244353;
  ntt(t1, len << 1, -1);
  for (int i = n + 2; i < (len << 1); i++) t1[i] = 0;
  reverse(t1, t1 + n + 2);
  for (int i = 0; i <= n + 1; i++)
    t1[i] =
        ((i & 1) ? 998244353 - 1 : 1) * facv[i] % 998244353 * t1[i] % 998244353;
  memset(t2, 0, sizeof(long long) * (len << 1));
  for (int i = 0; i <= n + 1; i++) t2[i] = facv[i];
  ntt(t1, len << 1, 1);
  ntt(t2, len << 1, 1);
  for (int i = 0; i < (len << 1); i++) t1[i] = t1[i] * t2[i] % 998244353;
  ntt(t1, len << 1, -1);
  for (int i = 0; i <= n; i++)
    ans[i] = (ans[i] + t1[i] * facd[i] % 998244353 * inv[n + 2]) % 998244353;
  memset(t1, 0, sizeof(long long) * (len << 1));
  memset(t2, 0, sizeof(long long) * (len << 1));
  for (int i = 0; i <= n + 1; i++) t1[i] = p[i];
  for (int i = 0; i <= n + 1; i++) t2[i] = q[i];
  ntt(t1, len << 1, 1);
  ntt(t2, len << 1, 1);
  for (int i = 0; i < (len << 1); i++) t1[i] = t1[i] * t2[i] % 998244353;
  ntt(t1, len << 1, -1);
  for (int i = n + 2; i < (len << 1); i++) t1[i] = 0;
  reverse(t1, t1 + n + 2);
  for (int i = 0; i <= n + 1; i++)
    t1[i] =
        ((i & 1) ? 998244353 - 1 : 1) * facv[i] % 998244353 * t1[i] % 998244353;
  memset(t2, 0, sizeof(long long) * (len << 1));
  for (int i = 0; i <= n + 1; i++) t2[i] = facv[i];
  ntt(t1, len << 1, 1);
  ntt(t2, len << 1, 1);
  for (int i = 0; i < (len << 1); i++) t1[i] = t1[i] * t2[i] % 998244353;
  ntt(t1, len << 1, -1);
  for (int i = 0; i < n; i++)
    ans[i + 1] =
        (ans[i + 1] - t1[i] * facd[i + 1] % 998244353 * inv[n + 2] % 998244353 +
         998244353) %
        998244353;
}
void solve2(int n) {
  static long long t1[Maxn], t2[Maxn];
  int len = 1;
  while (len < n + 5) len <<= 1;
  memset(p, 0, sizeof(long long) * (len << 1));
  memset(q, 0, sizeof(long long) * (len << 1));
  memset(t1, 0, sizeof(long long) * (len << 1));
  memset(t2, 0, sizeof(long long) * (len << 1));
  for (int i = 0; i <= n + 4; i++) t1[i] = facv[i];
  for (int i = n + 4; i > 0; i--)
    t1[i] = (t1[i - 1] - t1[i] + 998244353) % 998244353;
  for (int i = 0; i <= n + 2; i++) t1[i] = t1[i + 2];
  t1[n + 3] = t1[n + 4] = 0;
  getinv(t1, t2, len);
  for (int i = n + 3; i < len; i++) t2[i] = 0;
  for (int i = 1; i <= n + 2; i++) t2[i] = (t2[i] + t2[i - 1]) % 998244353;
  memcpy(p, t2, sizeof(long long) * (n + 3));
  reverse(p, p + n + 3);
  memset(t1, 0, sizeof(long long) * (len << 1));
  memset(t2, 0, sizeof(long long) * (len << 1));
  for (int i = 0; i <= 2 * n + 1; i++) t1[i] = facd[i];
  for (int i = 0; i <= n + 2; i++) t2[n + 2 - i] = p[i] * facv[i] % 998244353;
  ntt(t1, len << 1, 1);
  ntt(t2, len << 1, 1);
  for (int i = 0; i < (len << 1); i++) t1[i] = t1[i] * t2[i] % 998244353;
  ntt(t1, len << 1, -1);
  for (int i = 0; i < n; i++)
    ans[i + 1] = (ans[i + 1] + t1[n + 2 + i] * facv[i]) % 998244353;
}
void solve(int n) {
  static long long t1[Maxn], t2[Maxn];
  solve1(n);
  solve2(n);
  int len = 1;
  while (len < n + 2) len <<= 1;
  memset(t1, 0, sizeof(long long) * (len << 1));
  memset(t2, 0, sizeof(long long) * (len << 1));
  ans[0] = 1;
  for (int i = 0; i <= n; i++)
    t1[i] = ((i & 1) ? 998244353 - 1 : 1) * C(n + 2, i) % 998244353;
  for (int i = 0; i <= n; i++) t2[i] = ans[i];
  ntt(t1, len << 1, 1);
  ntt(t2, len << 1, 1);
  for (int i = 0; i < (len << 1); i++) t1[i] = t1[i] * t2[i] % 998244353;
  ntt(t1, len << 1, -1);
  for (int i = 0; i <= n; i++) ans[i] = t1[i] * facd[n] % 998244353;
}
int main() {
  ntt_init();
  pre(2e5 + 4);
  int n;
  scanf("%d", &n);
  solve(n);
  for (int i = 1; i <= n; i++) printf("%lld ", ans[i]);
  printf("\n");
  return 0;
}