{"trustable":true,"prependHtml":"\u003cscript\u003e window.katexOptions \u003d { disable: true }; \u003c/script\u003e\n\u003cscript type\u003d\"text/x-mathjax-config\"\u003e\n MathJax.Hub.Config({\n tex2jax: {\n inlineMath: [[\u0027$$$\u0027,\u0027$$$\u0027], [\u0027$\u0027,\u0027$\u0027]],\n displayMath: [[\u0027$$$$$$\u0027,\u0027$$$$$$\u0027], [\u0027$$\u0027,\u0027$$\u0027]]\n }\n });\n\u003c/script\u003e\n\u003cscript async src\u003d\"https://mathjax.codeforces.org/MathJax.js?config\u003dTeX-AMS-MML_HTMLorMML\" type\u003d\"text/javascript\"\u003e\u003c/script\u003e","sections":[{"title":"","value":{"format":"HTML","content":"\u003cdiv class\u003d\"panel_content\"\u003eYou are given two integers $n$,$m$.\u003cbr\u003e\u003cbr\u003eTwo array $x\u003d\\{x_0,x_1,\\dots ,x_{l-1}\\},y\u003d\\{ y_0,y_1,\\dots ,\\ y_{l-1}\\}$ of length $l$ are considered **different** if $x$ couldn\u0027t become $ y$ by performing the following operations any number of times:\u003cbr\u003e\u003cbr\u003e$\\bullet\\ $operation 1$:$ Change $x$ to $b$ , for each $i$ $(0\\leq i\u0026lt; l), b_i\\ \u003d\\ (x_i + 1 )\\ mod\\ m$\u003cbr\u003e\u003cbr\u003e$\\bullet\\ $operation 2$:$ Change $x$ to $b$ , for each $i$ $(0\\leq i\u0026lt; l),b_i\\ \u003d\\ x_{ (i+1)\\ mod\\ l } $\u003cbr\u003e\u003cbr\u003eAs an example, if $m\u003d3,\\ l\u003d3$, $(0,2,2)$ and $(0,1,0)$ are considered **not different** because $(0,2,2)$ can become $(0,1,0)$ as follows:\u003cbr\u003e$(0,2,2)\\stackrel{operation \\ 1}{\\longrightarrow}(1,0,0)\\stackrel{operation \\ 2}{\\longrightarrow}(0,0,1)\\stackrel{operation \\ 2}{\\longrightarrow}(0,1,0)$\u003cbr\u003e\u003cbr\u003eFor each $i$ $($$1\\leq i\\leq n$$)$, find the number of different integer array $a$ of length $i$, satisfied $\\forall j \\in ( 0,1,\\dots ,{i-1} ) , 0\\le a_j \\le m-1$.\u003cbr\u003e\u003cbr\u003eSince the answer may be too large, print it modulo $998244353$.\u003c/div\u003e"}},{"title":"Input","value":{"format":"HTML","content":"The first line of the input contains one integer $T$ $($$1\\leq T\\leq 100$$)$--- the number of test cases. Then $T$ testcases follow.\\\\\\\\Each of the next $T$ lines contains two integers $n,m$ $($$1\\leq n,m\\leq 100000$$)$.\u003cbr\u003e\u003cbr\u003eThe sum of $n$ over all testcases doesn\u0027t exceed $10^{6}$."}},{"title":"Output","value":{"format":"HTML","content":"For each testcase,output one line contains $n$ integers, separated by space, the $i$-th integer indicating the number of different $a$ of length $i$, modulo $998244353$.\u003cbr\u003e\u003cbr\u003e**Don‘t have spaces at the end of the line**"}},{"title":"Sample","value":{"format":"HTML","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e2\r\n10 2\r\n10 100000\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e1 2 2 4 4 8 10 20 30 56\r\n1 50001 338600275 682529035 345997022 799071125 767573961 525777344 672451750 695859947\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}}]}