AtCoder Regular Contest 102 - Stop. Otherwise...

Takahashi throws N dice, each having K sides with all integers from 1 to K. The dice are NOT pairwise distinguishable.
For each i=2,3,...,2K, find the following value modulo 998244353:
 - The number of combinations of N sides shown by the dice such that the sum of no two different sides is i.
Note that the dice are NOT distinguishable, that is, two combinations are considered different when there exists an integer k such that the number of dice showing k is different in those two.

-----Constraints-----
 - 1 \leq K \leq 2000
 - 2 \leq N \leq 2000
 - K and N are integers.

-----Input-----
Input is given from Standard Input in the following format:
K N

-----Output-----
Print 2K-1 integers. The t-th of them (1\leq t\leq 2K-1) should be the answer for i=t+1.

-----Sample Input-----
3 3

-----Sample Output-----
7
7
4
7
7

 - For i=2, the combinations (1,2,2),(1,2,3),(1,3,3),(2,2,2),(2,2,3),(2,3,3),(3,3,3) satisfy the condition, so the answer is 7.
 - For i=3, the combinations (1,1,1),(1,1,3),(1,3,3),(2,2,2),(2,2,3),(2,3,3),(3,3,3) satisfy the condition, so the answer is 7.
 - For i=4, the combinations (1,1,1),(1,1,2),(2,3,3),(3,3,3) satisfy the condition, so the answer is 4.

Difficulty: HARD

Starter code:

Solutions:
def cmb(n, r):
	if n < 0:
		return 0
	if n == 0:
		if r != 0:
			return 0
		else:
			return 1
	elif r < 0:
		return 0
	elif r > n:
		return 0
	elif r == 0:
		return 1
	elif r == n:
		return 1
	else:
		return A[n] * B[r] * B[n - r] % mod
mod = 998244353
A = [1, 1]
B = [1, 1]
for i in range(2, 4005):
	A.append(A[-1] * i % mod)
	B.append(B[-1] * pow(i, mod - 2, mod) % mod)
(k, n) = map(int, input().split())
if k == 1:
	print(0)
	return
ans = [0] * (2 * k + 1)
for i in range(2, k + 3):
	if i % 2 == 0:
		i = i + 1
		for j in range(min(n + 1, i // 2 + 1)):
			ans[i - 1] = (ans[i - 1] + cmb(n + k - i, k - i + j) * cmb(i // 2, j) * pow(2, j, mod)) % mod
	else:
		ans[i] = ans[i - 1]
for i in range(k + 2, 2 * k + 1):
	ans[i] = ans[2 * k + 2 - i]
for i in range(2, 2 * k + 1):
	print(ans[i])


import sys
input = sys.stdin.readline
MOD = 998244353
U = 10000
fact = [1] * (U + 1)
fact_inv = [1] * (U + 1)
for n in range(1, U + 1):
	fact[n] = fact[n - 1] * n % MOD
fact_inv[n] = pow(fact[n], MOD - 2, MOD)
for n in range(U, 0, -1):
	fact_inv[n - 1] = fact_inv[n] * n % MOD

def comb(n, k):
	if not 0 <= k <= n:
		return 0
	return fact[n] * fact_inv[k] * fact_inv[n - k] % MOD
(K, N) = map(int, input().split())

def F(x, y, N):
	n = min(x, N)
	return sum((comb(x, i) * pow(2, i, MOD) * comb(N + y - 1, i + y - 1) for i in range(n + 1))) % MOD
answer = []
for S in range(2, K + 2):
	if S & 1:
		x = F((S - 1) // 2, K - S + 1, N)
	else:
		x = F((S - 1) // 2, K - S + 1, N) + F((S - 1) // 2, K - S + 1, N - 1)
	answer.append(x % MOD)
answer += answer[:-1][::-1]
print('\n'.join(map(str, answer)))


mod = 998244353
(K, N) = map(int, input().split())
Factorial = [1] * (N + K + 1)
for i in range(1, N + K + 1):
	Factorial[i] = Factorial[i - 1] * i % mod

def power(x, y):
	if y == 0:
		return 1
	elif y == 1:
		return x % mod
	elif y % 2 == 0:
		return power(x, y // 2) ** 2 % mod
	else:
		return power(x, y // 2) ** 2 * x % mod
inverseFactorial = [1] * (N + K + 1)
inverseFactorial[N + K] = power(Factorial[N + K], mod - 2)
for i in range(0, N + K)[::-1]:
	inverseFactorial[i] = inverseFactorial[i + 1] * (i + 1) % mod

def C(x, y):
	if x < y or y < 0:
		return 0
	else:
		return Factorial[x] * inverseFactorial[y] * inverseFactorial[x - y] % mod

def H(x, y):
	return C(x + y - 1, y)

def ans(M, N, K):
	res = 0
	for m in range(1, M + 1)[::-1]:
		if m % 2:
			res += C(M, m) * H(K, N - 2 * m)
		else:
			res += -1 * C(M, m) * H(K, N - 2 * m)
	return (H(K, N) - res) % mod
for i in range(2, 2 * K + 1):
	if i % 2:
		print(ans(min(K, i - 1) - i // 2, N, K))
	else:
		print((ans(min(K, i - 1) - i // 2, N - 1, K - 1) + ans(min(K, i - 1) - i // 2, N, K - 1)) % mod)


M = 998244353
fact = None
factr = None

def comb(n, k):
	if n <= 0 or k < 0 or n < k:
		return 0
	r = fact[n] * factr[k] % M
	r *= factr[n - k]
	r %= M
	return r

def solve(k, n):
	nonlocal fact, factr
	inv = [1] * (k + n + 1)
	for i in range(2, k + n + 1):
		inv[i] = inv[M % i] * (M - M // i) % M
	fact = [1] * (k + n + 1)
	factr = [1] * (k + n + 1)
	for i in range(2, k + n + 1):
		fact[i] = fact[i - 1] * i % M
		factr[i] = factr[i - 1] * inv[i] % M
	if k == 1:
		print(0)
		return
	if k == 2:
		for _ in range(3):
			print(2)
		return
	g0 = (comb(k + n - 2, k - 2) + comb(k + n - 3, k - 2)) % M
	g1 = comb(k + n - 1, k - 1)
	rs0 = [0] * (min(k // 2, n // 2) + 1)
	rs1 = [0] * (min(k // 2, n // 2) + 1)
	for t in range(1, min(k // 2, n // 2) + 1):
		rs0[t] = (comb(k + n - 2 * t - 2, k - 2) + comb(k + n - 2 * t - 3, k - 2)) % M
		rs1[t] = comb(k + n - 2 * t - 1, k - 1)
	results = [0] * (k + 2)
	for i in range(2, k + 2):
		ns = (i - 1) // 2
		ans = g0 if i % 2 == 0 else g1
		p = -1
		for t in range(1, min(ns, n // 2) + 1):
			r = rs0[t] if i % 2 == 0 else rs1[t]
			r *= comb(ns, t)
			r %= M
			ans += M + p * r
			ans %= M
			p = 0 - p
		print(ans)
		results[i] = ans
	for i in range(k + 2, 2 * k + 1):
		print(results[2 * k + 2 - i])

def main():
	(k, n) = input().split()
	k = int(k)
	n = int(n)
	solve(k, n)

def __starting_point():
	main()
__starting_point()


(K, N) = map(int, input().split())
mod = 998244353
INV = [None] * (N + K + 2)
for i in range(1, N + K + 2):
	INV[i] = pow(i, mod - 2, mod)
Combi = [None] * (N + K + 1)
Combi[K - 1] = 1
for i in range(K, N + K + 1):
	Combi[i] = Combi[i - 1] * i * INV[i - K + 1] % mod
all = Combi[N + K - 1]
ANSLIST = []
for i in range(2, 2 + K):
	ANS = all
	x = i // 2 - max(0, i - K - 1)
	CB_x = 1
	j = 1
	while N + K - 1 - j * 2 >= K - 1 and j <= x:
		CB_x = CB_x * (x - j + 1) // j
		ANS += (-1) ** j * CB_x * Combi[N + K - 1 - j * 2]
		ANS = ANS % mod
		j += 1
	ANSLIST.append(ANS % mod)
for i in ANSLIST:
	print(i)
ANSLIST = ANSLIST[::-1]
for j in ANSLIST[1:]:
	print(j)


(K, N) = map(int, input().split())
mod = 998244353
A = []
p = mod - 2
while p != 0:
	A = [p % 2] + A[:]
	p //= 2

def inved(x):
	y = 1
	for _ in range(len(A)):
		if A[_] == 1:
			y *= x
			y %= mod
		if _ != len(A) - 1:
			y *= y
			y %= mod
	return y
X = [0 for i in range(2 * K - 1)]
frac = [1]
for i in range(N + K):
	frac.append((i + 1) * frac[i] % mod)
invf = []
for i in range(N + K + 1):
	invf.append(inved(frac[i]))
for k in range(2, K + 2):
	S = 0
	sign = 1
	l = k // 2
	for m in range(min(l + 1, N // 2 + 1)):
		prod = sign * (frac[l] * frac[N + K - 2 * m - 1]) % mod
		prod *= invf[m] * invf[l - m] % mod
		prod %= mod
		prod *= invf[N - 2 * m] * invf[K - 1] % mod
		prod %= mod
		S += prod
		S %= mod
		sign *= -1
	(X[k - 2], X[2 * K - k]) = (S, S)
for i in range(2 * K - 1):
	print(X[i])


mod = 998244353
eps = 10 ** (-9)

def main():
	import sys
	input = sys.stdin.readline
	nmax = 6 * 10 ** 3 + 10
	fac = [0] * nmax
	finv = [0] * nmax
	inv = [0] * nmax
	fac[0] = 1
	fac[1] = 1
	finv[0] = 1
	finv[1] = 1
	inv[1] = 1
	for i in range(2, nmax):
		fac[i] = fac[i - 1] * i % mod
		inv[i] = mod - inv[mod % i] * (mod // i) % mod
		finv[i] = finv[i - 1] * inv[i] % mod

	def comb(n, r):
		if n < r:
			return 0
		else:
			return fac[n] * (finv[r] * finv[n - r] % mod) % mod
	(K, N) = map(int, input().split())
	for i in range(2, 2 * K + 1):
		if i & 1:
			A = 0
			B = 0
			for j in range(1, K + 1):
				if 1 <= i - j <= K:
					A += 1
				else:
					B += 1
			A //= 2
			ans = 0
			for a in range(A + 1):
				if B == 0 and a == A:
					break
				ans = (ans + (-1) ** (a & 1) * (comb(N + (A + B - a) - 1, N) * pow(2, A - a, mod) % mod * comb(A, a)) % mod) % mod
			print(ans)
		else:
			A = 0
			B = 0
			for j in range(1, K + 1):
				if 1 <= i - j <= K:
					A += 1
				else:
					B += 1
			A = (A - 1) // 2
			ans = 0
			for a in range(A + 1):
				if B == 0 and a == A:
					break
				ans = (ans + (-1) ** (a & 1) * (comb(N + (A + B - a) - 1, N) * pow(2, A - a, mod) % mod * comb(A, a)) % mod) % mod
			for a in range(A + 1):
				if B == 0 and a == A:
					break
				ans = (ans + (-1) ** (a & 1) * (comb(N - 1 + (A + B - a) - 1, N - 1) * pow(2, A - a, mod) % mod * comb(A, a)) % mod) % mod
			print(ans)
main()


class Combination:

	def __init__(self, n_max, mod=10 ** 9 + 7):
		self.mod = mod
		self.modinv = self.make_modinv_list(n_max)
		(self.fac, self.facinv) = self.make_factorial_list(n_max)

	def __call__(self, n, r):
		return self.fac[n] * self.facinv[r] % self.mod * self.facinv[n - r] % self.mod

	def make_factorial_list(self, n):
		fac = [1]
		facinv = [1]
		for i in range(1, n + 1):
			fac.append(fac[i - 1] * i % self.mod)
			facinv.append(facinv[i - 1] * self.modinv[i] % self.mod)
		return (fac, facinv)

	def make_modinv_list(self, n):
		modinv = [0] * (n + 1)
		modinv[1] = 1
		for i in range(2, n + 1):
			modinv[i] = self.mod - self.mod // i * modinv[self.mod % i] % self.mod
		return modinv
mod = 998244353
(K, N) = map(int, input().split())
comb = Combination(10000, mod=mod)

def C(n, r):
	if n < r or r < 0:
		return 0
	else:
		return comb(n, r)

def H(n, r):
	return C(n + r - 1, r)
L = []
for i in range(2, 2 * K + 1, 2):
	ans = 0
	M = i // 2
	b = 1
	for (j, a) in enumerate(range(M, K)):
		if M - j < 0:
			break
		ans += pow(2, M - j, mod) * C(M, j) * H(K - a, N) * b
		ans %= mod
		b = -b
	print(ans)
	if i == K + 1:
		break
	elif i == K:
		print(ans)
		print(ans)
		break
	L.append(ans)
	print(ans)
	L.append(ans)
print(*L[::-1], sep='\n')


mod = 998244353
(k, n) = map(int, input().split())

def modinv(n):
	return pow(n, mod - 2, mod)
m = n + k
Fact = [1]
for i in range(1, m + 1):
	Fact.append(Fact[i - 1] * i % mod)
Finv = [0] * (m + 1)
Finv[-1] = modinv(Fact[-1])
for i in range(m - 1, -1, -1):
	Finv[i] = Finv[i + 1] * (i + 1) % mod

def comb(n, r):
	if r < 0 or n < r:
		return 0
	return Fact[n] * Finv[r] * Finv[n - r] % mod

def hcomb(n, r):
	return comb(n + r - 1, r)
Pow = [1] * (k + 1)
for i in range(k):
	Pow[i + 1] = Pow[i] * 2 % mod

def solve(x):
	ret = 0
	if x % 2:
		p = x // 2
		for q in range(p + 1):
			ret += Pow[q] * comb(p, q) * hcomb(k - 2 * p + q, n - q)
			ret %= mod
	else:
		p = x // 2 - 1
		for q in range(p + 1):
			ret += Pow[q] * comb(p, q) * (hcomb(k - 2 * p + q - 1, n - q) + hcomb(k - 2 * p + q - 1, n - q - 1))
			ret %= mod
	return ret
Ans = []
for i in range(2, k + 2):
	Ans.append(solve(i))
print(*Ans, sep='\n')
print(*reversed(Ans[:k - 1]), sep='\n')


def mul(c, m, dp):
	for i in range(m, c - 1, -1):
		dp[i] += dp[i - c]
		dp[i] %= MOD

def mul2(c, m, dp):
	for i in range(m, c - 1, -1):
		dp[i] -= dp[i - c]
		dp[i] %= MOD

def div(c, m, dp):
	for i in range(m - c + 1):
		dp[i + c] += dp[i]
		dp[i + c] %= MOD
import sys
readline = sys.stdin.readline
read = sys.stdin.read
MOD = 998244353
(k, n) = map(int, readline().split())
ans = [0] * (2 * k + 1)
dp = [1] + [0] * n
for _ in range(k - 1):
	div(1, n, dp)
ans[2] = dp[n - 1] + dp[n]
for i in range(3, k + 2):
	if i % 2:
		mul(1, n, dp)
		ans[i] = dp[n]
	else:
		mul2(1, n, dp)
		ans[i] = dp[n - 1] + dp[n]
for i in range(k + 2, 2 * k + 1):
	ans[i] = ans[2 + 2 * k - i]
for i in ans[2:]:
	print(i % MOD)


from collections import defaultdict, deque
import sys, heapq, bisect, math, itertools, string, queue, datetime
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
mod = 998244353
eps = 10 ** (-7)

def inp():
	return int(input())

def inpl():
	return list(map(int, input().split()))

def inpls():
	return list(input().split())
(K, N) = inpl()
MAX = K + N + 10
fac = [1] * (MAX + 1)
for i in range(1, MAX + 1):
	fac[i] = fac[i - 1] * i % mod
gyakugen = [1] * (MAX + 1)
gyakugen[MAX] = pow(fac[MAX], mod - 2, mod)
for i in range(MAX, 0, -1):
	gyakugen[i - 1] = gyakugen[i] * i % mod

def Comb(n, k):
	return fac[n] * gyakugen[k] * gyakugen[n - k] % mod

def calc(k, n, i):
	pairs = (i - 2) // 2
	k -= pairs
	n -= pairs
	if n < 0 or k <= 0:
		return 0
	elif k == 1 and n >= 2:
		return 0
	if n == 0:
		ans = 1
	else:
		ans = 0
		for x in range(2):
			ball = n - x
			box = k - 1
			ans += Comb(box - 1 + ball, ball) % mod
	ans *= pow(2, pairs, mod)
	return ans % mod
ans = []
for i in range(2, K + 2):
	if i % 2 == 0:
		pairs = (i - 2) // 2
		tmp = 0
		for p0 in range(pairs + 1):
			tmp += calc(K - p0 * 2, N, i - p0 * 2) * Comb(pairs, p0) % mod
			tmp %= mod
	ans.append(tmp)
	print(tmp)
ans = ans[::-1]
for i in range(1, K):
	print(ans[i])


import sys
sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep='\n')

def II():
	return int(sys.stdin.readline())

def MI():
	return map(int, sys.stdin.readline().split())

def LI():
	return list(map(int, sys.stdin.readline().split()))

def LLI(rows_number):
	return [LI() for _ in range(rows_number)]

def SI():
	return sys.stdin.readline()[:-1]

def nCr(com_n, com_r):
	if com_n < com_r:
		return 0
	return fac[com_n] * ifac[com_r] % md * ifac[com_n - com_r] % md

def nHr(hn, hr):
	return nCr(hn + hr - 1, hr)
md = 998244353
n_max = 5000
fac = [1]
for i in range(1, n_max + 1):
	fac.append(fac[-1] * i % md)
ifac = [1] * (n_max + 1)
ifac[n_max] = pow(fac[n_max], md - 2, md)
for i in range(n_max - 1, 1, -1):
	ifac[i] = ifac[i + 1] * (i + 1) % md

def solve():
	res = 0
	for p in range(min(t, n) // 2 + 1):
		cur = nCr(t // 2, p) * nHr(k, n - 2 * p)
		if p & 1:
			res -= cur
		else:
			res += cur
		res %= md
	return res
(k, n) = MI()
ans = []
for t in range(2, k + 2):
	a = solve()
	ans.append(a)
	print(a)
ans.reverse()
for a in ans[1:]:
	print(a)


def prepare(n, MOD):
	f = 1
	factorials = [1]
	for m in range(1, n + 1):
		f *= m
		f %= MOD
		factorials.append(f)
	inv = pow(f, MOD - 2, MOD)
	invs = [1] * (n + 1)
	invs[n] = inv
	for m in range(n, 1, -1):
		inv *= m
		inv %= MOD
		invs[m - 1] = inv
	return (factorials, invs)

def solve_sub(k, n, p, factorials, invs):
	ret = 0
	(fp, ik) = (factorials[p], invs[k - 1])
	for q in range(1, min(p, n // 2) + 1):
		tmp1 = fp * invs[q] % MOD * invs[p - q] % MOD
		tmp2 = factorials[k + n - 2 * q - 1] * invs[n - 2 * q] % MOD * ik % MOD
		if q % 2 == 1:
			ret += tmp1 * tmp2
		else:
			ret -= tmp1 * tmp2
		ret %= MOD
	return ret

def solve(k, n):
	if k == 1:
		return [0]
	(factorials, invs) = prepare(k + n, MOD)
	all_patterns_odd = factorials[k + n - 1] * invs[n] * invs[k - 1] % MOD
	all_patterns_even0 = factorials[k + n - 2] * invs[n] * invs[k - 2] % MOD
	all_patterns_even1 = factorials[k + n - 3] * invs[n - 1] * invs[k - 2] % MOD
	buf = []
	for i in range(2, k + 2):
		pairs = i // 2 - max(0, i - k - 1)
		if i % 2 == 0:
			ans = all_patterns_even0 - solve_sub(k - 1, n, pairs - 1, factorials, invs)
			ans += all_patterns_even1 - solve_sub(k - 1, n - 1, pairs - 1, factorials, invs)
			ans %= MOD
		else:
			ans = (all_patterns_odd - solve_sub(k, n, pairs, factorials, invs)) % MOD
		buf.append(ans)
	return buf
MOD = 998244353
(k, n) = list(map(int, input().split()))
ans = solve(k, n)
print('\n'.join(map(str, ans)))
print('\n'.join(map(str, ans[-2::-1])))


import sys
(K, N) = map(int, input().split())
P = 998244353
kaizyo = [0]
kaizyo_inv = [0]
tmp = 1
for i in range(1, N + K):
	tmp = tmp * i % P
	kaizyo.append(tmp)
	kaizyo_inv.append(pow(tmp, P - 2, P))

def comb(n, r):
	if n < r or r < 0:
		return 0
	elif n == r or r == 0:
		return 1
	else:
		return kaizyo[n] * kaizyo_inv[r] * kaizyo_inv[n - r]
inv_2 = pow(2, P - 2, P)
anss = ''
for i in range(2, 2 * K + 1):
	ans = 0
	n_pair = min((i - 1) // 2, (2 * K - i + 1) // 2)
	out_pair = max(0, K - i + 1, i - K - 1)
	which_use = pow(2, n_pair + 1, P)
	for j in range(n_pair + 1):
		if n_pair - j > N:
			which_use = which_use * inv_2 % P
			continue
		not_use = comb(n_pair, j)
		which_use = which_use * inv_2 % P
		dice_cnt = comb(N - 1 + out_pair, n_pair - j - 1 + out_pair)
		if i % 2 == 0:
			dice_cnt = (dice_cnt + comb(N - 2 + out_pair, n_pair - j - 1 + out_pair)) % P
		tmp = not_use * which_use % P
		tmp = tmp * dice_cnt % P
		ans = (ans + tmp) % P
	anss += str(ans) + '\n'
print(anss.rstrip())


from sys import exit, setrecursionlimit, stderr
from functools import reduce
from itertools import *
from collections import defaultdict
from bisect import bisect

def read():
	return int(input())

def reads():
	return [int(x) for x in input().split()]
(K, N) = reads()
MOD = 998244353
MAXN = 4020
fact = [1] * MAXN
for i in range(1, MAXN):
	fact[i] = fact[i - 1] * i % MOD
invfact = [0] * MAXN
invfact[-1] = pow(fact[-1], MOD - 2, MOD)
for i in range(MAXN - 2, -1, -1):
	invfact[i] = invfact[i + 1] * (i + 1) % MOD

def comb(n, k):
	return fact[n] * invfact[n - k] * invfact[k] % MOD if 0 <= k <= n else 0

def h(n, k):
	return comb(n + k - 1, n)

def solve(n, k, u):
	ans = 0
	for q in range(u + 1):
		ans = (ans + comb(u, q) * pow(2, u - q, MOD) % MOD * h(n - u + q, k - q - u)) % MOD
	return ans
anss = [0] * (2 * K + 1)
for i in range(2, K + 2):
	u = sum((j < i - j <= K for j in range(1, K + 1)))
	if i % 2 == 1:
		ans = solve(N, K, u)
	else:
		ans = (solve(N, K - 1, u) + solve(N - 1, K - 1, u)) % MOD
	anss[i] = ans
	print(ans)
for j in range(K + 2, 2 * K + 1):
	print(anss[2 * K - j + 2])


(K, N) = list(map(int, input().split()))
MAX = K + N + 3
mod = 998244353
fac = [1] * (MAX + 1)
for i in range(1, MAX + 1):
	fac[i] = fac[i - 1] * i % mod
rev_m = [1] * (MAX + 1)
rev_m[MAX] = pow(fac[MAX], mod - 2, mod)
for i in range(MAX, 0, -1):
	rev_m[i - 1] = rev_m[i] * i % mod

def Comb(n, k):
	return fac[n] * rev_m[k] * rev_m[n - k] % mod

def f(n, k, i):
	if i == 2:
		if n < 0 or (k == 1 and n >= 2):
			return 0
		if n == 0:
			ans = 1
		else:
			ans = Comb(k - 2 + n, n) + Comb(k - 2 + n - 1, n - 1)
		return ans % mod
	else:
		Sp = i // 2 - 1
		ans = 0
		for p in range(Sp + 1):
			ans += g(n, k, i, p)
		return ans % mod

def g(n, k, i, p):
	Sp = i // 2 - 1
	if p == 0:
		return f(n - Sp, k - Sp, 2) * pow(2, Sp, mod) % mod
	else:
		return g(n, k - 2 * p, i - 2 * p, 0) * Comb(Sp, p)
ans = []
for i in range(2, K + 2):
	if i % 2 == 0:
		tmp = f(N, K, i)
	ans.append(tmp)
	print(tmp)
ans = ans[::-1]
for i in range(1, K):
	print(ans[i])


(K, N) = map(int, input().split())
MOD = 998244353
P = N + K
fact = [1] * (P + 1)
rfact = [1] * (P + 1)
for i in range(P):
	fact[i + 1] = r = (i + 1) * fact[i] % MOD
	rfact[i + 1] = pow(r, MOD - 2, MOD)

def comb(n, k):
	return fact[n] * rfact[k] * rfact[n - k] % MOD
V = [1] * (P + 1)
r = 1
for i in range(P):
	r = r * 2 % MOD
	V[i + 1] = r * rfact[i + 1] % MOD
memo = {}

def calc(A):
	if A in memo:
		return memo[A]
	M = A // 2
	r = 0
	if A % 2:
		p = K - 2 * M + N - 2
		for m in range(max(0, 2 * M + 2 - K), min(M, N - 1) + 1):
			r += V[m] * rfact[M - m] * (fact[p] * rfact[N - m] + fact[p - 1] * rfact[N - m - 1]) * rfact[p - N + m] % MOD
		if 2 * M + 2 - K <= N <= M:
			r += V[N] * rfact[M - N] % MOD
		r *= fact[M]
	else:
		p = K - 2 * M + N - 1
		for m in range(max(0, 2 * M + 1 - K), min(N, M) + 1):
			r += V[m] * rfact[M - m] * rfact[N - m] * rfact[p - N + m] % MOD
		r *= fact[M] * fact[p]
	r = memo[A] = r % MOD
	return r
ans = []
for i in range(2, 2 * K + 1):
	if i <= K:
		ans.append(calc(i - 1))
	else:
		ans.append(calc(2 * K - i + 1))
print(*ans, sep='\n')


mod = 998244353
rng = 4100
fctr = [1]
finv = [1]
for i in range(1, rng):
	fctr.append(fctr[-1] * i % mod)
for i in range(1, rng):
	finv.append(pow(fctr[i], mod - 2, mod))

def cmb(n, k):
	if n < 0 or k < 0:
		return 0
	else:
		return fctr[n] * finv[n - k] * finv[k] % mod

def homo(n, k):
	if n < 0 or k <= 0:
		return 0
	else:
		return cmb(n + k - 1, k - 1)
(k, n) = map(int, input().split())
if k % 2 == 0:
	flg = 0
else:
	flg = 1
ans = []
for i in range(3, k + 2, 2):
	ic = (i - 1) // 2
	anstmp = 0
	for j in range(ic + 1):
		t = homo(n - j, k - ic * 2 + j) * cmb(ic, j) * pow(2, j, mod)
		anstmp = (anstmp + t) % mod
	ans.append(anstmp)
	ans.append(anstmp)
if flg:
	anstmp = 0
	for j in range(1, k // 2 + 1):
		t = (homo(n - j, j) + homo(n - j - 1, j)) * cmb(k // 2, j) * pow(2, j, mod)
		anstmp = (anstmp + t) % mod
	ans.append(anstmp)
ans2 = ans[:-1]
ans2 = ans2[::-1]
print(*ans, sep='\n')
print(*ans2, sep='\n')


MOD = 998244353
(k, n) = list(map(int, input().split()))
facts = [1]
invs = [1]
pow2 = [1]
for i in range(1, n + k):
	f = i * facts[i - 1] % MOD
	facts.append(f)
	invs.append(pow(f, MOD - 2, MOD))
	pow2.append(2 ** i % MOD)

def nCk(n, k):
	return facts[n] * invs[k] * invs[n - k] % MOD

def nHk(n, k):
	return nCk(n + k - 1, n - 1)
ans = []
for i in range(2, k + 2):
	p = i // 2
	ans_i = 0
	for q in range(min(p + 1, n + 1)):
		if k - i + q < 0:
			continue
		if i % 2 > 0:
			ans_i = ans[-1]
			break
		else:
			ans_iq = 0
			if q > 0 and k - i + q > 0:
				ans_iq = (ans_iq + pow2[q - 1] * nCk(p - 1, q - 1) * nHk(k - (i - 1) + (q - 1), n - q)) % MOD
			if q < p:
				ans_iq = (ans_iq + pow2[q] * nCk(p - 1, q) * nHk(k - (i - 1) + q, n - q)) % MOD
		ans_i = (ans_i + ans_iq) % MOD
	ans.append(ans_i)
for a in ans + ans[-2::-1]:
	print(a)


(K, N) = map(int, input().split())
MOD = 998244353
P = N + K
fact = [1] * (P + 1)
rfact = [1] * (P + 1)
for i in range(P):
	fact[i + 1] = r = (i + 1) * fact[i] % MOD
	rfact[i + 1] = pow(r, MOD - 2, MOD)

def comb(n, k):
	return fact[n] * rfact[k] * rfact[n - k] % MOD

def h(n, k):
	if n < 0 or k < 0:
		return 0
	return comb(n + k, k)

def calc(A):
	M = A // 2
	r = 0
	if A % 2:
		p = K - 2 * M + N - 2
		for m in range(M + 1):
			if K - 2 * M - 2 + m < 0 or N - m < 0:
				continue
			r += pow(2, m, MOD) * comb(M, m) * (h(K - 2 * M - 2 + m, N - m) + h(K - 2 * M - 2 + m, N - m - 1)) % MOD
	else:
		p = K - 2 * M + N - 1
		for m in range(M + 1):
			if K - 2 * M - 1 + m < 0 or N - m < 0:
				continue
			r += pow(2, m, MOD) * comb(M, m) * h(K - 2 * M - 1 + m, N - m) % MOD
	return r % MOD
ans = []
for i in range(2, 2 * K + 1):
	if i <= K:
		ans.append(calc(i - 1))
	else:
		ans.append(calc(2 * K - i + 1))
print(*ans, sep='\n')


(K, N) = map(int, input().split())
mod = 998244353
L = max(K, N)
table = [1] * (3 * L + 5)
t = 1
for i in range(1, 3 * L + 5):
	t *= i
	t %= mod
	table[i] = t
rtable = [1] * (3 * L + 5)
t = 1
for i in range(1, 3 * L + 5):
	t *= pow(i, mod - 2, mod)
	t %= mod
	rtable[i] = t
ans = []
for k in range(2, K + 2):
	num = 0
	if k % 2 == 1:
		l = k // 2
		p = l
		r = K - 2 * l
		for q in range(l + 1):
			if N - q >= 0 and r + q - 1 >= 0:
				s = table[l] * rtable[q] * rtable[l - q] % mod
				s = s * pow(2, q, mod) % mod
				t = table[N + r - 1] * rtable[N - q] * rtable[r + q - 1] % mod
				s = s * t % mod
				num += s
				num = num % mod
		ans.append(num)
	else:
		l = k // 2
		p = l - 1
		r = K - k + 1
		for q in range(p + 1):
			if N - q - 1 >= 0 and r + q - 1 >= 0:
				s = table[p] * rtable[q] * rtable[p - q] % mod
				s = s * pow(2, q, mod) % mod
				t = table[N + r - 2] * rtable[N - q - 1] * rtable[r + q - 1] % mod
				s = s * t % mod
				num += s
				num %= mod
			if N - q >= 0 and r + q - 1 >= 0:
				s = table[p] * rtable[q] * rtable[p - q] % mod
				s = s * pow(2, q, mod) % mod
				t = table[N + r - 1] * rtable[N - q] * rtable[r + q - 1] % mod
				s = s * t % mod
				num += s
				num %= mod
		ans.append(num)
print('\n'.join(map(str, ans)))
ans = ans[::-1]
print('\n'.join(map(str, ans[1:])))


MOD = 998244353
(k, n) = map(int, input().split())
list_size = 5000
f_list = [1] * list_size
f_r_list = [1] * list_size
for i in range(list_size - 1):
	f_list[i + 1] = int(f_list[i] * (i + 2) % MOD)

def power(n, x):
	if x == 1:
		return n
	elif x % 2 == 0:
		return power(int(n * n % MOD), int(x / 2))
	else:
		return int(n * power(n, x - 1) % MOD)
f_r_list[-1] = power(f_list[-1], MOD - 2)
for i in range(2, list_size + 1):
	f_r_list[-i] = int(f_r_list[-i + 1] * (list_size + 2 - i) % MOD)

def comb(n, r):
	if n < r or r < 0:
		return 0
	elif n == 0 or r == 0 or n == r:
		return 1
	else:
		return f_list[n - 1] * f_r_list[n - r - 1] % MOD * f_r_list[r - 1] % MOD
ans = []
for i in range(2, k + 2):
	num = 0
	if i % 2 == 1:
		for j in range(0, i // 2 + 1):
			num += comb(i // 2, j) * pow(2, j, MOD) * comb(n + k - i, k - i + j)
			num %= MOD
	else:
		for j in range(0, i // 2):
			num += comb(i // 2 - 1, j) * pow(2, j, MOD) * comb(n + k - i, k - i + j)
			num += comb(i // 2 - 1, j) * pow(2, j, MOD) * comb(n + k - i - 1, k - i + j)
			num %= MOD
	ans.append(num)
print(*ans, sep='\n')
ans = reversed(ans[:k - 1])
print(*ans, sep='\n')


(K, N) = map(int, input().split())
mod = 998244353

def inved(a):
	(x, y, u, v, k, l) = (1, 0, 0, 1, a, mod)
	while l != 0:
		(x, y, u, v) = (u, v, x - u * (k // l), y - v * (k // l))
		(k, l) = (l, k % l)
	return x % mod
X = [0 for i in range(2 * K - 1)]
frac = [1]
for i in range(N + K):
	frac.append((i + 1) * frac[i] % mod)
invf = []
for i in range(N + K + 1):
	invf.append(inved(frac[i]))
for k in range(2, K + 2):
	S = 0
	sign = 1
	l = k // 2
	for m in range(min(l + 1, N // 2 + 1)):
		prod = sign * (frac[l] * frac[N + K - 2 * m - 1]) % mod
		prod *= invf[m] * invf[l - m] % mod
		prod %= mod
		prod *= invf[N - 2 * m] * invf[K - 1] % mod
		prod %= mod
		S += prod
		S %= mod
		sign *= -1
	(X[k - 2], X[2 * K - k]) = (S, S)
for i in range(2 * K - 1):
	print(X[i])


(K, N) = list(map(int, input().split()))
dprint = lambda *x: x

def cmb(n, r, mod):
	if r < 0 or r > n:
		return 0
	r = min(r, n - r)
	return g1[n] * g2[r] * g2[n - r] % mod
mod = 998244353
__N = 8000
g1 = [1, 1]
g2 = [1, 1]
inverse = [0, 1]
for i in range(2, __N + 1):
	g1.append(g1[-1] * i % mod)
	inverse.append(-inverse[mod % i] * (mod // i) % mod)
	g2.append(g2[-1] * inverse[-1] % mod)

def kumiawase(p, q):
	return cmb(p + q - 1, q - 1, mod)

def solve(n):
	assert n <= K + 1
	ans = 0
	kumi = (n - 1) // 2
	for p in range(kumi + 1):
		if p > N:
			break
		ans += 2 ** p * cmb(kumi, p, mod) * kumiawase(N - p, p + (K - kumi * 2 - int(n % 2 == 0)))
		if n % 2 == 0 and N - p - 1 >= 0:
			ans += 2 ** p * cmb(kumi, p, mod) * kumiawase(N - p - 1, p + (K - kumi * 2 - int(n % 2 == 0)))
	return ans
ans = []
for i in range(2, 2 * K + 1):
	if i <= K + 1:
		tmp = solve(i) % 998244353
		ans.append(tmp)
		print(tmp)
	else:
		print(ans[-i + K])


(k, n) = map(int, input().split())
mod = 998244353
max_n = 5000
(fac, finv, inv) = ([0] * max_n, [0] * max_n, [0] * max_n)

def comInit(max_n):
	fac[0] = fac[1] = 1
	finv[0] = finv[1] = 1
	inv[1] = 1
	for i in range(2, max_n):
		fac[i] = fac[i - 1] * i % mod
		inv[i] = mod - inv[mod % i] * (mod // i) % mod
		finv[i] = finv[i - 1] * inv[i] % mod
comInit(max_n)

def com(n, k):
	if n < k:
		return 0
	if (n < 0) | (k < 0):
		return 0
	return fac[n] * (finv[k] * finv[n - k] % mod) % mod
ex2 = [1] * 1010
for i in range(1, 1010):
	ex2[i] = ex2[i - 1] * 2 % mod
ans = []
for j in range(2, k + 2):
	tmp = 0
	x = (j - 1) // 2
	for i in range(j // 2 + 1):
		comb1 = com(n + k - j, n - i)
		comb2 = com(x, i) * ex2[i] % mod
		if j % 2 == 0:
			comb1 += com(n + k - j - 1, n - i - 1)
			comb1 %= mod
		tmp += comb1 * comb2
		tmp %= mod
	ans.append(tmp)
ans2 = ans[:-1]
ans += ans2[::-1]
print('\n'.join(map(str, ans)))


MOD = 998244353
(k, n) = list(map(int, input().split()))
facts = [1]
invs = [1]
for i in range(1, n + k):
	f = i * facts[i - 1] % MOD
	facts.append(f)
	invs.append(pow(f, MOD - 2, MOD))

def nCk(n, k):
	return facts[n] * invs[k] * invs[n - k] % MOD
memo = []
for p in range(1, (k + 3) // 2):
	i = 2 * p + 1
	tmp = 0
	for t in range(min(p + 1, n + 1)):
		if k - i + t < 0:
			continue
		res = nCk(p, t)
		res *= nCk(n + k - i, k - i + t)
		res *= pow(2, t, MOD)
		tmp = (tmp + res) % MOD
	memo.append(tmp)
ans = []
for i in range(1, k):
	ans.append(memo[(i - 1) // 2])
for a in ans + [memo[-1]] + ans[::-1]:
	print(a)


(k, n) = map(int, input().split())
mod = 998244353
fact = [1] * (n + k + 1)
rfact = [1] * (n + k + 1)
for i in range(n + k):
	fact[i + 1] = rr = (i + 1) * fact[i] % mod
	rfact[i + 1] = pow(rr, mod - 2, mod)

def comb(N, K, mod):
	return fact[N] * rfact[K] * rfact[N - K] % mod
kota = []
for i in range(2, k + 2):
	ans = 0
	if i % 2 == 1:
		pp = (i + 1) // 2
		pm = i - pp
		p = min(k - pp + 1, pm)
		for q in range(p + 1):
			sen = comb(p, q, mod) * pow(2, q, mod) % mod
			if n - q < 0:
				break
			r = k - p * 2
			if r < 0:
				r = 0
			if n + r - 1 < n - q:
				continue
			ans += sen * comb(n + r - 1, n - q, mod) % mod
		kota.append(ans % mod)
	else:
		pp = i // 2 + 1
		pm = i // 2 - 1
		p = min(k - pp + 1, pm)
		for q in range(p + 1):
			sen = comb(p, q, mod) * pow(2, q, mod) % mod
			if n - q < 0:
				break
			r = k - p * 2 - 1
			if r < 0:
				r = 0
			if n + r - 1 < n - q:
				continue
			ans += sen * comb(n + r - 1, n - q, mod) % mod
		for q in range(p + 1):
			sen = comb(p, q, mod) * pow(2, q, mod) % mod
			if n - q - 1 < 0:
				break
			r = k - p * 2 - 1
			if r < 0:
				r = 0
			if n + r - 2 < n - q - 1:
				continue
			ans += sen * comb(n + r - 2, n - q - 1, mod) % mod
		kota.append(ans % mod)
for i in kota:
	print(i)
for i in range(len(kota) - 2, -1, -1):
	print(kota[i])


N = 4010
p = 998244353
mi2 = [0] * N
inv = [0] * N
fac = [0] * N

def C(x, y):
	return fac[x] * inv[y] * inv[x - y] % p

def Calc(n, a, b):
	ans = 0
	for i in range(min(a, n) + 1):
		if i == b == 0:
			continue
		ans += C(a, i) * mi2[i] * C(n + b - 1, n - i) % p
	return ans % p
mi2[0] = fac[0] = inv[0] = inv[1] = 1
for i in range(1, N):
	mi2[i] = mi2[i - 1] * 2 % p
	fac[i] = fac[i - 1] * i % p
for i in range(2, N):
	inv[i] = inv[p % i] * (p - p // i) % p
for i in range(2, N):
	inv[i] = inv[i - 1] * inv[i] % p
(k, n) = map(int, input().split())
for i in range(2, 2 * k + 1):
	ans = 0
	cnt = min(k, i - 1 >> 1) - max(i - k, 1) + 1
	if i & 1:
		ans += Calc(n, cnt, k - cnt * 2)
	else:
		ans += Calc(n, cnt, k - cnt * 2 - 1)
		ans += Calc(n - 1, cnt, k - cnt * 2 - 1)
	print(ans % p)


from collections import Counter
(K, N) = map(int, input().split())
mod = 998244353
frac = [1] * 5010
for i in range(2, 5010):
	frac[i] = i * frac[i - 1] % mod
fraci = [None] * 5010
for i in range(5010):
	fraci[i] = pow(frac[i], mod - 2, mod)

def comb(a, b):
	if not a >= b >= 0:
		return 0
	return frac[a] * fraci[b] * fraci[a - b] % mod
A = Counter()

def calc(x):
	if A[x]:
		return A[x]
	res = 0
	for i in range(N // 2 + 1):
		res = (res + (-1) ** i * comb(x, i) * comb(N + K - 1 - 2 * i, N - 2 * i)) % mod
	A[x] = res
	return res
for j in range(2, 2 * K + 1):
	print(calc(min(j, 2 * K + 2 - j) // 2))


import sys
stdin = sys.stdin

def li():
	return map(int, stdin.readline().split())

def li_():
	return map(lambda x: int(x) - 1, stdin.readline().split())

def lf():
	return map(float, stdin.readline().split())

def ls():
	return stdin.readline().split()

def ns():
	return stdin.readline().rstrip()

def lc():
	return list(ns())

def ni():
	return int(stdin.readline())

def nf():
	return float(stdin.readline())

def inv_mod(n: int, mod: int) -> list:
	inv = [0, 1]
	for i in range(2, n + 1):
		inv.append(mod - mod // i * inv[mod % i] % mod)
	return inv

def fact(n: int, mod: int) -> list:
	fac = [1, 1]
	res = 1
	for i in range(2, n + 1):
		res = res * i % mod
		fac.append(res)
	return fac

def fact_inv(n: int, inv: list, mod: int) -> list:
	facInv = [1, 1]
	for i in range(2, n + 1):
		facInv.append(facInv[i - 1] * inv[i] % mod)
	return facInv

def nCr(n: int, r: int, mod: int, fac: list, facInv: list) -> int:
	if not (0 <= r and r <= n):
		return 0
	return fac[n] * facInv[r] % mod * facInv[n - r] % mod
MOD = 998244353
(k, n) = li()
inv = inv_mod(n + k, MOD)
fac = fact(n + k, MOD)
facInv = fact_inv(n + k, inv, MOD)
answers = []
if k == 1:
	print(0)
else:
	for t in range(2, k + 2):
		p = t // 2
		ans = 0
		if t % 2 == 0:
			temp = 0
			for q in range(p):
				temp = temp + nCr(p - 1, q, MOD, fac, facInv) * 2 ** q * nCr(n + k - 2 * p, n - q, MOD, fac, facInv)
				temp %= MOD
				temp = temp + nCr(p - 1, q, MOD, fac, facInv) * 2 ** q * nCr(n + k - 2 * p - 1, n - q - 1, MOD, fac, facInv)
				temp %= MOD
			ans = temp % MOD
		else:
			temp = 0
			for q in range(p + 1):
				temp = temp + nCr(p, q, MOD, fac, facInv) * 2 ** q * nCr(n + k - 2 * p - 1, n - q, MOD, fac, facInv)
				temp %= MOD
			ans = temp % MOD
		answers.append(ans)
		print(ans)
for ans in answers[-2::-1]:
	print(ans)


(K, N) = map(int, input().split())
MOD = 998244353
fact = [1] * 4000
t = 1
for i in range(1, 4000):
	t = t * i % MOD
	fact[i] = t
factinv = [1] * 4000
for i in range(1, 4000):
	factinv[i] = pow(fact[i], MOD - 2, MOD)

def ncr(n, r):
	if n < 0 or r < 0 or n - r < 0:
		return 0
	return fact[n] * factinv[r] * factinv[n - r] % MOD

def nhr(n, r):
	if n == 0 and r == 0:
		return 1
	return ncr(n + r - 1, r)
for i in range(2, 2 * K + 1):
	(t1, t2) = (0, 0)
	Ans = 0
	np = i // 2 - max(i - 1 - K, 0)
	if i % 2 == 0:
		np -= 1
		for nq in range(np + 1):
			t1 = ncr(np, nq) * pow(2, nq, MOD)
			t1 %= MOD
			t2 = nhr(K - np * 2 + nq - 1, N - nq)
			t2 %= MOD
			Ans = (Ans + t1 * t2) % MOD
			t2 = nhr(K - np * 2 + nq - 1, N - nq - 1)
			t2 %= MOD
			Ans = (Ans + t1 * t2) % MOD
	else:
		for nq in range(np + 1):
			t1 = ncr(np, nq) * pow(2, nq, MOD)
			t1 %= MOD
			t2 = nhr(K - np * 2 + nq, N - nq)
			t2 %= MOD
			Ans = (Ans + t1 * t2) % MOD
	print(Ans % MOD)


mod = 998244353
(k, n) = map(int, input().split())

def inv(a, mod):
	r = [1, 0, a]
	w = [0, 1, mod]
	while w[2] != 1:
		q = r[2] // w[2]
		r_new = [r[0] - q * w[0], r[1] - q * w[1], r[2] - q * w[2]]
		r = w
		w = r_new
	(x, y) = (w[0], w[1])
	return (mod + x % mod) % mod
max_num = 2 * 10 ** 5 + 1
fact = [0 for _ in range(max_num)]
ifact = [0 for _ in range(max_num)]
fact[0] = fact[1] = 1
ifact[0] = ifact[1] = 1
for i in range(2, max_num):
	fact[i] = fact[i - 1] * i % mod
ifact[max_num - 1] = inv(fact[max_num - 1], mod)
for i in range(2, max_num):
	ifact[max_num - i] = ifact[max_num - i + 1] * (max_num - i + 1) % mod

def comb(x, y):
	if x < 0 or y < 0 or x < y:
		return 0
	else:
		return fact[x] * ifact[y] * ifact[x - y] % mod
if k == 1:
	print(0)
	exit()
elif k == 2:
	print(2)
	print(2)
	print(2)
	exit()
ansl = [0] * (2 * k - 1)
for ii in range(2, 2 * k + 1):
	ans = 0
	j = max(1, ii - k)
	if i % 2 == 0:
		pair = ii // 2 - j
		mid = 1
	else:
		pair = (ii + 1) // 2 - j
		mid = 0
	if pair == 0:
		ans += comb(n - 1 + k - 2, k - 2) + comb(n + k - 2, k - 2)
		ans %= mod
	elif mid == 0:
		for i in range(pair + 1):
			if k - 2 * pair + i == 0:
				continue
			ans += comb(pair, i) * 2 ** i * comb(n - i + k - 2 * pair + i - 1, k - 2 * pair + i - 1)
			ans %= mod
	else:
		for i in range(pair + 1):
			if k - 2 * pair - mid + i == 0:
				continue
			ans += comb(pair, i) * 2 ** i * comb(n - i - 1 + k - 2 * pair - mid + i - 1, k - 2 * pair - mid + i - 1)
			ans += comb(pair, i) * 2 ** i * comb(n - i + k - 2 * pair - mid + i - 1, k - 2 * pair - mid + i - 1)
			ans %= mod
	ansl[ii - 2] = ans
	if ii == k + 1:
		break
for i in range(k - 1):
	print(ansl[i])
print(ansl[k - 1])
for i in range(k + 1, 2 * k):
	print(ansl[2 * k - 1 - i])


def modfac(n, MOD):
	f = 1
	factorials = [1]
	for m in range(1, n + 1):
		f *= m
		f %= MOD
		factorials.append(f)
	inv = pow(f, MOD - 2, MOD)
	invs = [1] * (n + 1)
	invs[n] = inv
	for m in range(n, 1, -1):
		inv *= m
		inv %= MOD
		invs[m - 1] = inv
	return (factorials, invs)

def modnCr(n, r, mod, fac, inv):
	return fac[n] * inv[n - r] * inv[r] % mod

def modnHr(n, r, mod, fac, inv):
	return modnCr(n + r - 1, n, mod, fac, inv)
(K, N) = map(int, input().split())
mod = 998244353
(fac, inv) = modfac(N + K + 10, mod)
for k in range(2, 2 * K + 1):
	ans = 0
	if k % 2 == 1:
		if k <= K:
			t = k // 2
		else:
			t = (2 * K - k + 1) // 2
		x = K - t * 2
		if x == 0:
			end = t
		else:
			end = t + 1
		for u in range(0, end):
			now = modnCr(t, u, mod, fac, inv) * pow(2, t - u, mod) * modnHr(N, x + t - u, mod, fac, inv)
			if u % 2 == 0:
				ans += now
			else:
				ans -= now
			ans %= mod
	else:
		if k <= K:
			t = (k - 1) // 2
		else:
			t = (2 * K - k) // 2
		x = K - t * 2 - 1
		if x == 0:
			end = t
		else:
			end = t + 1
		for u in range(0, end):
			now = modnCr(t, u, mod, fac, inv) * pow(2, t - u, mod) * (modnHr(N, x + t - u, mod, fac, inv) + modnHr(N - 1, x + t - u, mod, fac, inv))
			if u % 2 == 0:
				ans += now
			else:
				ans -= now
			ans %= mod
	print(ans % mod)


mod = 998244353

def cmb(n, r):
	if r < 0 or r > n:
		return 0
	return g1[n] * g2[r] * g2[n - r] % mod
g1 = [1, 1]
g2 = [1, 1]
inv = [0, 1]
for i in range(2, 100003):
	g1.append(g1[-1] * i % mod)
	inv.append(-inv[mod % i] * (mod // i) % mod)
	g2.append(g2[-1] * inv[-1] % mod)
(K, N) = map(int, input().split())
C = [0] * (2 * K)
for i in range(K):
	for j in range(i + 1, K):
		C[i + j] += 1
for i in range(2 * K - 1):
	P = 0
	if i & 1:
		for j in range(C[i] + 1):
			P = (P + cmb(K + N - 2 * C[i] - 1, N - j) * pow(2, j, mod) * cmb(C[i], j)) % mod
	else:
		for k in range(2):
			for j in range(C[i] + 1):
				P = (P + cmb(K + N - 2 * C[i] - 2 - k, N - j - k) * pow(2, j, mod) * cmb(C[i], j)) % mod
	print(P)


(k, n) = list(map(int, input().split()))
mod = 998244353
fact = [1] * (n + k + 1)
rfact = [1] * (n + k + 1)
for i in range(1, n + k):
	fact[i] = r = i * fact[i - 1] % mod
	rfact[i] = pow(r, mod - 2, mod)
save = []
for p in range(1, int((k + 3) / 2)):
	i = 2 * p + 1
	temp = 0
	for t in range(min(p + 1, n + 1)):
		if k - i + t < 0:
			continue
		res = fact[p] * rfact[t] * rfact[p - t] % mod
		res *= fact[n + k - i] * rfact[k - i + t] * rfact[n - t] % mod
		res *= pow(2, t, mod)
		temp = (temp + res) % mod
	save.append(temp)
output = []
i = 1
while i < k:
	output.append(save[(i - 1) // 2])
	i += 1
for x in output + [save[-1]] + output[::-1]:
	print(x)


(K, N) = map(int, input().split())
mod = 998244353

def cmb(n, r, mod):
	if r < 0 or r > n:
		return 0
	r = min(r, n - r)
	return g1[n] * g2[r] * g2[n - r] % mod

def H(n, k, mod):
	return cmb(n + k - 1, k, mod)
Nmax = 10 ** 5
g1 = [1, 1]
g2 = [1, 1]
inv = [0, 1]
for i in range(2, Nmax + 1):
	g1.append(g1[-1] * i % mod)
	inv.append(-inv[mod % i] * (mod // i) % mod)
	g2.append(g2[-1] * inv[-1] % mod)
ans = []
for i in range(2, K + 2):
	res = 0
	if i % 2 == 1:
		for j in range(i // 2 + 1):
			res += cmb(i // 2, j, mod) * 2 ** j * H(K - i // 2 * 2 + j, N - j, mod)
			res %= mod
	else:
		for j in range(i // 2):
			res += cmb(i // 2 - 1, j, mod) * 2 ** j * H(K - i + 1 + j, N - j, mod)
			res += cmb(i // 2 - 1, j, mod) * 2 ** j * H(K - i + 1 + j, N - 1 - j, mod)
			res %= mod
	ans.append(res)
for elem in ans + ans[-2::-1]:
	print(elem)


from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor, cos, radians, pi, sin
from operator import mul
from functools import reduce
from operator import mul
sys.setrecursionlimit(2147483647)
INF = 10 ** 13

def LI():
	return list(map(int, sys.stdin.buffer.readline().split()))

def I():
	return int(sys.stdin.buffer.readline())

def LS():
	return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()

def S():
	return sys.stdin.buffer.readline().rstrip().decode('utf-8')

def IR(n):
	return [I() for i in range(n)]

def LIR(n):
	return [LI() for i in range(n)]

def SR(n):
	return [S() for i in range(n)]

def LSR(n):
	return [LS() for i in range(n)]

def SRL(n):
	return [list(S()) for i in range(n)]

def MSRL(n):
	return [[int(j) for j in list(S())] for i in range(n)]
mod = 998244353
n = 6000
fac = [1] * (n + 1)
inv = [1] * (n + 1)
for j in range(1, n + 1):
	fac[j] = fac[j - 1] * j % mod
inv[n] = pow(fac[n], mod - 2, mod)
for j in range(n - 1, -1, -1):
	inv[j] = inv[j + 1] * (j + 1) % mod

def comb(n, r):
	if r > n or n < 0 or r < 0:
		return 0
	return fac[n] * inv[n - r] * inv[r] % mod

def h(n, r):
	return comb(n + r - 1, r - 1)
(k, n) = LI()
for i in range(2, 2 * k + 1):
	ret = 0
	m = min(i // 2, k - (i + 1) // 2 + 1)
	if i % 2:
		for j in range(m + 1):
			ret += comb(m, j) * pow(2, j, mod) * h(n - j, k - m * 2 + j)
	else:
		for j in range(m + 1):
			if j:
				ret += comb(m - 1, j - 1) * pow(2, j - 1, mod) * h(n - j, k - m * 2 + j)
				ret += comb(m - 1, j) * pow(2, j, mod) * h(n - j, k - m * 2 + 1 + j)
			else:
				ret += comb(m, j) * pow(2, j, mod) * h(n - j, k - m * 2 + 1 + j)
	print(ret % mod)


mod = 998244353
(k, n) = list(map(int, input().split()))
C = [[0 for i in range(n + k + 1)] for j in range(n + k + 1)]
pw = [0 for i in range(n + k + 1)]
for i in range(0, n + k + 1):
	C[i][0] = 1
	if i == 0:
		pw[i] = 1
	else:
		pw[i] = (pw[i - 1] << 1) % mod
	for j in range(1, i + 1):
		C[i][j] = (C[i - 1][j - 1] + C[i - 1][j]) % mod

def calc(tot, seg):
	if tot < 0:
		return 0
	return C[tot + seg - 1][tot]
for i in range(2, k + k + 1):
	ans = su = 0
	if i <= k:
		su = i - 1
	else:
		su = k + k - i + 1
	if i & 1:
		for j in range(0, (su >> 1) + 1):
			ans = (ans + calc(n - j, k - su + j) * pw[j] % mod * C[su >> 1][j]) % mod
	else:
		for j in range(0, (su >> 1) + 1):
			ans = (ans + calc(n - j - 1, k - su + j) * pw[j] % mod * C[su >> 1][j]) % mod
			ans = (ans + calc(n - j, k - su + j) * pw[j] % mod * C[su >> 1][j]) % mod
	print(ans)


def prepare(k, n, MOD):

	def get_factorials(m):
		f = 1
		factorials = [1]
		for m in range(1, m + 1):
			f *= m
			f %= MOD
			factorials.append(f)
		inv = pow(f, MOD - 2, MOD)
		invs = [1] * (m + 1)
		invs[m] = inv
		for m in range(m, 1, -1):
			inv *= m
			inv %= MOD
			invs[m - 1] = inv
		return (factorials, invs)

	def solve(p):
		if cache[p] > -1:
			return cache[p]
		ret = 0
		fp = factorials[p]
		for q in range(1, min(p, n // 2) + 1):
			tmp1 = fp * invs[q] % MOD * invs[p - q] % MOD
			tmp2 = factorials[k + n - 2 * q - 1] * invs[n - 2 * q] % MOD * ik % MOD
			if q % 2 == 1:
				ret += tmp1 * tmp2
			else:
				ret -= tmp1 * tmp2
			ret %= MOD
		cache[p] = ret = (all_patterns - ret) % MOD
		return ret
	(factorials, invs) = get_factorials(k + n)
	ik = invs[k - 1]
	all_patterns = factorials[k + n - 1] * invs[n] * ik % MOD
	cache = [-1] * (k // 2 + 2)
	return solve
MOD = 998244353
(k, n) = list(map(int, input().split()))
if k == 1:
	print(0)
else:
	solve = prepare(k, n, MOD)
	ans = [solve(i // 2 - max(0, i - k - 1)) for i in range(2, k + 2)]
	print('\n'.join(map(str, ans)))
	print('\n'.join(map(str, ans[-2::-1])))


(K, N) = map(int, input().split())
P = 998244353
fa = [1]
for i in range(1, 10000):
	fa.append(fa[-1] * i % P)
fainv = [pow(fa[-1], P - 2, P)]
for i in range(1, 10000)[::-1]:
	fainv.append(fainv[-1] * i % P)
fainv = fainv[::-1]

def C(a, b):
	if not (a >= 0 and 0 <= b <= a):
		return 0
	return fa[a] * fainv[a - b] * fainv[b] % P
A = []
for i in range(1, (K + 1) // 2 + 1):
	s = 0
	for j in range(i + 1):
		s += C(N + K - 1 - 2 * j, K - 1) * C(i, j) * (-1) ** j
		s %= P
	A.append(s)
for i in range(2 * K - 1):
	print(A[min(i // 2, (2 * K - i - 2) // 2)])


(K, N) = (int(i) for i in input().split())
(mod, ans, kn) = (998244353, [], K + N)
(fn, fk) = ([1] * kn, [1] * kn)
for i in range(kn - 1):
	fn[i + 1] = fn[i] * (i + 2) % mod

def power(n, k):
	if k == 1:
		return n
	elif k % 2 == 0:
		return power(n ** 2 % mod, k // 2)
	else:
		return n * power(n, k - 1) % mod

def comb(n, k):
	if n == 0 or k == 0 or n == k:
		return 1
	else:
		return fn[n - 1] * fk[n - k - 1] % mod * fk[k - 1] % mod
fk[-1] = power(fn[-1], mod - 2)
for i in range(2, kn + 1):
	fk[-i] = fk[-i + 1] * (kn + 2 - i) % mod
x = comb(kn - 1, N)
for i in range(2, K + 2):
	(num, c, y, p) = (N - 2, 1, 0, i // 2)
	while num > -1 and c <= p:
		if c % 2:
			y = (y + comb(p, c) * comb(K + num - 1, num)) % mod
		else:
			y = (y - comb(p, c) * comb(K + num - 1, num)) % mod
		(num, c) = (num - 2, c + 1)
	ans.append((x - y) % mod)
for i in range(2, K + 2):
	print(ans[i - 2])
for i in range(K, 1, -1):
	print(ans[i - 2])


def solve():
	MOD = 998244353
	maxNK = 2000
	(K, N) = list(map(int, input().split()))

	def getInvs(n, MOD):
		invs = [1] * (n + 1)
		for x in range(2, n + 1):
			invs[x] = -(MOD // x) * invs[MOD % x] % MOD
		return invs

	def getCombss(n, k, invs, MOD):

		def getCombNs(n, k, invs, MOD):
			combNs = [1] * (n // 2 + 1)
			for x in range(1, n // 2 + 1):
				combNs[x] = combNs[x - 1] * (n - x + 1) * invs[x] % MOD
			return (combNs + combNs[:(n + 1) // 2][::-1])[:k + 1]
		combss = [[] for n in range(n + 1)]
		for x in range(n + 1):
			combss[x] = getCombNs(x, k, invs, MOD)
			combss[x] += [0] * (k + 1 - len(combss[x]))
		return combss
	invs = getInvs(2 * maxNK, MOD)
	combss = getCombss(2 * maxNK, maxNK, invs, MOD)

	def getPows(base, n, MOD):
		pows = [1] * (n + 1)
		for x in range(1, n + 1):
			pows[x] = pows[x - 1] * base % MOD
		return pows
	pow2s = getPows(2, N, MOD)
	anss = []
	for i in range(2, K + 2, 2):
		ans = 0
		numFree = abs(K + 1 - i)
		numPair = (K - numFree + 1) // 2
		numPair -= 1
		for x in range(min(numPair, N) + 1):
			ans += combss[numPair][x] * pow2s[x] * combss[N + numFree - 1][N - x] % MOD
			ans %= MOD
		for x in range(min(numPair, N) + 1):
			ans += combss[numPair][x] * pow2s[x] * combss[N + numFree - 2][N - x - 1] % MOD
			ans %= MOD
		anss.append(ans)
		if i + 1 <= K + 1:
			anss.append(ans)
	anss = anss + anss[:-1][::-1]
	print('\n'.join(map(str, anss)))
solve()


import sys
input = sys.stdin.readline
mod = 998244353

def cmb(n, r, mod=mod):
	if r < 0 or r > n:
		return 0
	r = min(r, n - r)
	return g1[n] * g2[r] * g2[n - r] % mod
NN = 10 ** 5
g1 = [1, 1]
g2 = [1, 1]
inverse = [0, 1]
for i in range(2, NN + 1):
	g1.append(g1[-1] * i % mod)
	inverse.append(-inverse[mod % i] * (mod // i) % mod)
	g2.append(g2[-1] * inverse[-1] % mod)
(K, N) = map(int, input().split())
for i in range(2, 2 * K + 1):
	if i % 2 == 1:
		p = min(i // 2, (2 * K - i + 1) // 2)
		ans = 0
		t = 1
		for c in range(min(N, p) + 1):
			ans = (ans + cmb(K + N - 2 * p - 1, N - c) * cmb(p, c) * t) % mod
			t = t * 2 % mod
		print(ans)
	else:
		p = min(i // 2 - 1, (2 * K - i) // 2)
		ans = 0
		t = 1
		for c in range(min(N, p) + 1):
			ans = (ans + (cmb(K + N - 2 * p - 3, N - c - 1) + cmb(K + N - 2 * p - 2, N - c)) * cmb(p, c) * t) % mod
			t = t * 2 % mod
		print(ans)


import math
import sys
(K, N) = [int(i) for i in input().split(' ')]
mod = 998244353
sys.setrecursionlimit(100000)

def mul(a, b):
	return a % mod * (b % mod) % mod

def cmb_f(n, r, mod):
	if r < 0 or r > n:
		return 0
	r = min(r, n - r)
	return g1[n] * g2[r] * g2[n - r] % mod
NNN = 10 ** 4
g1 = [1, 1]
g2 = [1, 1]
inverse = [0, 1]
for i in range(2, NNN + 1):
	g1.append(g1[-1] * i % mod)
	inverse.append(-inverse[mod % i] * (mod // i) % mod)
	g2.append(g2[-1] * inverse[-1] % mod)

def EN(i):
	k2 = int((K - abs(K - int((i - 1) / 2) * 2)) / 2)
	k1 = K - k2 * 2 - (1 if i % 2 == 0 else 0)
	result = 0
	for j in range(k2 + 1):
		if N < j:
			break
		result = (result + mul(mul(cmb_f(k2, j, mod), cmb_f(N + k1 - 1, j + k1 - 1, mod)), pow(2, j) % mod)) % mod
	if i % 2 == 1:
		return result
	for j in range(k2 + 1):
		if N - 1 < j:
			break
		result = (result + mul(mul(cmb_f(k2, j, mod), cmb_f(N + k1 - 2, j + k1 - 1, mod)), pow(2, j) % mod)) % mod
	return result
if K == 1:
	print(0)
else:
	result = []
	for i in range(K):
		result.append(str(EN(i + 2)))
	print('\n'.join(result + result[:-1][::-1]))