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>
clock_t __t = clock();
namespace my_std {
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
template <typename T>
inline T rnd(T l, T r) {
  return uniform_int_distribution<T>(l, r)(rng);
}
template <typename T>
inline bool chkmax(T& x, T y) {
  return x < y ? x = y, 1 : 0;
}
template <typename T>
inline bool chkmin(T& x, T y) {
  return x > y ? x = y, 1 : 0;
}
template <typename T>
inline void read(T& t) {
  t = 0;
  char f = 0, ch = getchar();
  double d = 0.1;
  while (ch > '9' || ch < '0') f |= (ch == '-'), ch = getchar();
  while (ch <= '9' && ch >= '0') t = t * 10 + ch - 48, ch = getchar();
  if (ch == '.') {
    ch = getchar();
    while (ch <= '9' && ch >= '0') t += d * (ch ^ 48), d *= 0.1, ch = getchar();
  }
  t = (f ? -t : t);
}
template <typename T, typename... Args>
inline void read(T& t, Args&... args) {
  read(t);
  read(args...);
}
char __sr[1 << 21], __z[20];
int __C = -1, __zz = 0;
inline void Ot() { fwrite(__sr, 1, __C + 1, stdout), __C = -1; }
inline void print(int x) {
  if (__C > 1 << 20) Ot();
  if (x < 0) __sr[++__C] = '-', x = -x;
  while (__z[++__zz] = x % 10 + 48, x /= 10)
    ;
  while (__sr[++__C] = __z[__zz], --__zz)
    ;
  __sr[++__C] = '\n';
}
void file() {}
inline void chktime() {}
long long ksm(long long x, int y) {
  long long ret = 1;
  for (; y; y >>= 1, x = x * x % 998244353ll)
    if (y & 1) ret = ret * x % 998244353ll;
  return ret;
}
long long inv(long long x) { return ksm(x, 998244353ll - 2); }
}  // namespace my_std
using namespace my_std;
long long fac[5555], _fac[5555];
void init() {
  _fac[0] = fac[0] = 1;
  for (int i = (1); i <= (5555 - 1); i++)
    _fac[i] = inv(fac[i] = fac[i - 1] * i % 998244353ll);
}
long long C(int n, int m) {
  return n >= m && m >= 0
             ? fac[n] * _fac[m] % 998244353ll * _fac[n - m] % 998244353ll
             : 0;
}
int n;
long long S[5555][5555];
long long f[5555];
long long ans[5555];
int main() {
  file();
  init();
  read(n);
  S[0][0] = 1;
  for (int i = (1); i <= (n); i++)
    for (int j = (1); j <= (i); j++)
      S[i][j] = (S[i - 1][j - 1] + j * S[i - 1][j]) % 998244353ll;
  for (int j = (0); j <= (n); j++)
    for (int i = (j + 1); i <= (n); i++)
      (f[j] += S[i][i - j] * fac[i - j] % 998244353ll * _fac[i] %
               998244353ll) %= 998244353ll;
  for (int k = (0); k <= (n - 1); k++)
    for (int j = (k); j <= (n); j++)
      (ans[k + 1] += C(j, k) * (((j - k) & 1) ? 998244353ll - 1 : 1) %
                     998244353ll * f[j] % 998244353ll) %= 998244353ll;
  for (int i = (1); i <= (n); i++)
    printf("%lld ", ans[i] * fac[n] % 998244353ll);
  return 0;
}