{"raw_statement":[{"iden":"statement","content":"这是一道 [模板题](https://uoj.ac/problem/763)。\n\n给定正整数 $n,q,mod$。保证 $mod$ 是质数。\n\n对于一棵以点 $1$ 为根的有根树 $T$，设 $s(T)$ 为这棵树中最多能选出多少个互不同构的子树（也就是这颗树本质不同的子树个数），那么这个树的权值 $w(T) = q^{s(T)}$。\n\n对于所有 $1 \\le m \\le n$，输出所有大小为 $m$，根为 $1$ 的有标号树的权值之和对 $mod$ 取模后的值。\n\n两棵有根树 $T_1$、$T_2$ 同构当且仅当他们的大小相等，且存在一个顶点排列 $\\sigma$ 使得在 $T_1$ 中 $i$ 是 $j$ 的祖先当且仅当在 $T_2$ 中 $\\sigma(i)$ 是 $\\sigma(j)$ 的祖先。\n"},{"iden":"input","content":"一行两个整数，表示 $n,q,mod$。\n"},{"iden":"output","content":"输出 $n$ 行，第 $m$ 行表示 $m$ 个点的答案。"},{"iden":"note","content":"#### 样例解释 1\n\n$n=3,q=2,mod=998244353$ 时，有三颗不同三个点的根为 $1$ 的有标号树，其中两颗满足 $w(T)=2^3$，另一颗满足 $w(T)=2^2$。因此答案为 $(2 \\times 2^3+2^2) \\bmod 998244353 = 20$。\n\n#### 限制与约定\n\n对于所有测试数据，保证 $n = 100, 10^8 \\le mod \\le 1.01 \\times 10^9, 1 \\le q < mod$，且 $mod$ 是质数。\n\n本题共 $1$ 个子任务，每个子任务 $100$ 分。你在每个子任务中的得分为该子任务所有测试点的得分的最小值。\n\n**你必须按照输出格式输出 $n$ 个数，但是你可以输出错误的答案**。如果你输出了 $c$ 个正确的答案，那么你获得的分数按照如下方式计算：\n\n- 对于 $0 \\le c \\le 20$，你的得分为 $2c$ 分；\n- 对于 $21 \\le c \\le 60$，你的得分为 $c + 20 $ 分。\n- 对于 $61 \\le c \\le 100$，你的得分为 $\\lfloor \\frac{c}{2}\\rfloor + 50$ 分。\n\n时间限制：$\\texttt{4s}$。\n空间限制：$\\texttt{2048MB}$。\n\n你可以使用下面的代码来加速你的取模。\n\n```cpp\nstruct fastmod {\n  typedef unsigned long long u64;\n  typedef __uint128_t u128;\n\n  int m;\n  u64 b;\n\n  fastmod(int m) : m(m), b(((u128)1 << 64) / m) {}\n  int reduce(u64 a) {\n    u64 q = ((u128)a * b) >> 64;\n    int r = a - q * m;\n    return r < m ? r : r - m;\n  }\n} z(2);\nvoid solve() {\n\tlong long mod = 998244353, qwq = 1e9;\n\tz = fastmod(mod);\n\tcout << z.reduce(qwq) << ' ' << qwq % mod << '\\n';\n}\n```"}],"translated_statement":null,"sample_group":[["3 2 998244353","2\n4\n20"],["11 4514 998244353","4514\n20376196\n299712732\n706663250\n721357660\n977589073\n794002114\n369586566\n663682963\n347458730\n524354925"],["40 787788 998244853","787788\n699879231\n445785131\n857102003\n759492151\n898159394\n575712517\n634469464\n412999753\n814233648\n333451903\n852329440\n584109489\n270769240\n532457985\n79235443\n2228568\n266810999\n310877128\n614605839\n485785485\n338520973\n113751992\n692026056\n664258393\n650448721\n505881810\n237159658\n107178163\n629910112\n513627947\n915509519\n737809847\n921731327\n233492829\n202989716\n728903945\n776060784\n105388817\n121481849"]],"show_order":[],"formal_statement":null,"simple_statement":null,"has_page_source":false}