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;
template <class T>
inline T rd() {
  T x = 0;
  long long f = 1;
  char c = getchar();
  while (c > '9' || c < '0') f = c == '-' ? -1 : 1, c = getchar();
  while (c >= '0' && c <= '9') x = x * 10 + c - 48, c = getchar();
  return x * f;
}
template <class T>
inline void write(T x) {
  if (x < 0) {
    putchar('-'), write(-x);
    return;
  }
  if (x >= 10) write(x / 10);
  putchar(x % 10 + 48);
}
template <class T>
inline void write_(T x) {
  if (x < 0) {
    putchar('-'), write(-x);
    putchar(' ');
    return;
  }
  if (x >= 10) write(x / 10);
  putchar(x % 10 + 48);
  putchar(' ');
}
template <class T>
inline void writeln(T x) {
  if (x < 0) {
    putchar('-'), write(-x);
    putchar('\n');
    return;
  }
  if (x >= 10) write(x / 10);
  putchar(x % 10 + 48);
  putchar('\n');
}
template <class T>
inline T min(T a, T b, T c) {
  return min(min(a, b), c);
}
template <class T>
inline T max(T a, T b, T c) {
  return max(max(a, b), c);
}
template <class T>
inline T min(T a, T b, T c, T d) {
  return min(min(a, b), min(c, d));
}
template <class T>
inline T max(T a, T b, T c, T d) {
  return max(max(a, b), max(c, d));
}
template <class T>
inline T fpow(T a, T b, T c) {
  T ans = 1;
  while (b) {
    if (b & 1) ans = 1ll * ans * a % c;
    a = 1ll * a * a % c;
    b >>= 1;
  }
  return ans;
}
template <class T>
inline T fpow(T a, T b) {
  T ans = 1;
  while (b) {
    if (b & 1) ans = 1ll * ans * a;
    a = 1ll * a * a;
    b >>= 1;
  }
  return ans;
}
template <class T>
inline T gcd(T a, T b) {
  if (!b) return a;
  return gcd(b, a % b);
}
template <class T>
inline T lcm(T a, T b) {
  return a / gcd(a, b) * b;
}
template <class T>
inline void Exgcd(T a, T b, T &x, T &y) {
  if (b == 0) {
    x = 1;
    y = 0;
    return;
  }
  Exgcd(b, a % b, x, y);
  T tp = x;
  x = y;
  y = tp - a / b * y;
}
const int mod = 998244353;
const int MOD = 998244353;
long long fac[5005 + 5], inv[5005 + 5], invs[5005 + 5], EulN[5005][5005];
void init() {
  fac[0] = invs[0] = 1;
  fac[1] = invs[1] = inv[1] = 1;
  for (int i = 2; i <= 5005; i++) fac[i] = fac[i - 1] * i % mod;
  for (int i = 2; i <= 5005; i++) inv[i] = (mod - mod / i) * inv[mod % i] % mod;
  for (int i = 2; i <= 5005; i++) invs[i] = invs[i - 1] * inv[i] % mod;
}
long long C(int n, int m) { return fac[n] * invs[n - m] % mod * invs[m] % mod; }
int main() {
  ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  int n;
  cin >> n;
  init();
  EulN[0][0] = 1;
  for (int i = 0; i <= n; i++) EulN[i][0] = 1;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= i; j++)
      EulN[i][j] =
          EulN[i - 1][j - 1] * (i - j) % mod + EulN[i - 1][j] * (j + 1) % mod;
  for (int i = 0; i < n; i++) {
    long long ans = 0;
    for (int j = max(1, i); j <= n; j++) {
      ans = ans + C(n, j) * EulN[j][i] % mod * fac[n - j] % mod;
      ans %= mod;
    }
    while (ans < 0) ans += mod;
    cout << ans << '\n';
  }
  return 0;
}