Present

Time limit: 2.5s Memory limit: 512MB Input: Output:

Laika has decided to make a gift for her good friend Azusa, the witch of the highlands. For reasons we do not know, this gift will be a finite set of positive integers. If that were all, it would be a simple matter to choose a gift, but several factors complicate this.

First of all, Laika’s rival, Flatorte, has mysterious magical powers: given two integers xx and yy she can create the greatest common divisor of xx and yy (i.e. gcd(x,y)gcd(x, y)). If Laika gave a gift that Flatorte could immediately add to (i.e. if she gifted a set AA for which x,yAx, y \in A, yet gcd(x,y)Agcd(x, y) \notin A), then Flatorte would immediately tease her rival. Therefore, Laika’s gift must not be improvable using Flatorte’s powers: if she gifts AA then for all x,yAx, y \in A it must be the case that gcd(x,y)Agcd(x, y) \in A.

Secondly, Laika wants the gift to have a certain special significance. It has been KK days since she met Azusa, and she wants the gift to show this fact. Therefore, she has arranged all of the sets that satisfy the condition explained above in Laikan order (explained below), getting an infinite sequence of finite sets S0,S1,S_0, S_1, \dots. She wants to select and gift set SKS_K. Can you help her do so?

Laikan order. Take two sets AA and BB. Then, AA comes before BB in Laikan order if and only if maxA<maxBmaxA < maxB, or maxA=maxBmaxA = maxB and A{maxA}A - \{maxA\} comes before B{maxB}B - \{maxB\} in Laikan order. For the purposes of this definition, take max ∅=max \ ∅ = −∞. Note that this is always well defined for finite sets of positive integers.

Input data

The first line of the input contains a single integer TT, the number of test cases in this file. The next TT lines each contain a value of KK for which we want to know SKS_K.

Output data

For each of the TT values of KK, output the set SKS_K. To output a set, output a line that begins with the number of elements it has, and the continues with its elements, in increasing order.

Restrictions

  • 1T51 \leq T \leq 5
# Points Restrictions
1 8 0K1000 \leq K \leq 100
2 21 0K1 000 0000 \leq K \leq 1 \ 000 \ 000
3 41 0K500 000 0000 \leq K \leq 500 \ 000 \ 000
4 14 0K1 000 000 0000 \leq K \leq 1 \ 000 \ 000 \ 000
5 16 0K1 500 000 0000 \leq K \leq 1 \ 500 \ 000 \ 000

Example 1

stdin

5
0
1
2
3
4

stdout

0
1 1
1 2
2 1 2
1 3

Example 2

stdin

4
5
6
100
1000

stdout

2 1 3
3 1 2 3
5 1 2 3 7 8
7 1 2 3 5 10 11 12

Explanations

Note that S0=,S1={1},S2={2},S3={1,2},S4={3},S5={1,3},S6={1,2,3},S100={1,2,3,7,8},S1 000={1,2,3,5,10,11,12}S_0 = ∅, S_1 = \{1\}, S_2 = \{2\}, S_3 = \{1, 2\}, S_4 = \{3\}, S_5 = \{1, 3\}, S_6 = \{1, 2, 3\}, S_{100} = \{1, 2, 3, 7, 8\}, S_{1 \ 000} = \{1, 2, 3, 5, 10, 11, 12\}. These are precisely the sets outputted in the examples (together with their sizes). Observe that S6{2,3}S_6 \neq \{2, 3\} — this is because 2,3{2,3}2, 3 \in \{2, 3\}, yet gcd(2,3)=1{2,3}gcd(2, 3) = 1 \notin \{2, 3\}.

Log in or sign up to be able to send submissions!