#P7813. Array Repairing

Array Repairing

Array Repairing

Problem Description

Given an integer nn, a sequence a[1..n]a[1..n] is randomly generated with equal probability, namely, ai[1,n]a_i \in [1,n], i[1,n]\forall i \in [1,n]. Note that it may be not a permutation of 1..n1..n. To turn it into ai=i,i[1,n]a_i=i,\forall i \in [1,n], you can perform any of the following two operations for any times: 1.Choose i,j[1,n],iji,j \in [1,n],i\not = j, swap ai,aja_i,a_j costing 11. 2.Choose i,v[1,n]i,v \in [1,n], set ai=va_i = v costing kk. For example, if you perform operations of the first kind for 55 times and perform operations of the second kind for 44 times, then it will cost you 4×k+54 \times k + 5. Denote costk(a)cost_k(a) as the minimum total cost for the sequence aa with the parameter kk. For each k[0,2]k \in [0,2], print the mathematical expectation E(costk(a))E(cost_k(a)) modmod 998244353998244353 . Now, you need to answer the above question for each n[1,N]n \in [1,N]. That is to say, you should print 3×N3 \times N values in total.

Input

One line contains only one integer NN, N[1, 5×105]N \in [1,\ 5 \times 10^5].

Output

You should output NN lines with each containing 33 values E(costk(a))E(cost_k(a)) modmod 998244353998244353 , k[0,2]\forall k \in [0,2] separated by two spaces.

Sample Input

example 1:
1
example 2:
2

Sample Output

example 1:
0 0 0
example 2:
0 0 0
0 249561089 748683266

Source

2020 Multi-University Training Contest 5