Problem: An agent called Cypher is decrypting a message, that contains a [composite number](https://en.wikipedia.org/wiki/Composite_number) n. All divisors of n, which are greater than 1, are placed in a circle. Cypher can choose the initial order of numbers in the circle.

In one move Cypher can choose two adjacent numbers in a circle and insert their [least common multiple](https://en.wikipedia.org/wiki/Least_common_multiple) between them. He can do that move as many times as needed.

A message is decrypted, if every two adjacent numbers are not coprime. Note that for such constraints it's always possible to decrypt the message.

Find the minimal number of moves that Cypher should do to decrypt the message, and show the initial order of numbers in the circle for that.

Input

The first line contains an integer t (1 ≤ t ≤ 100) — the number of test cases. Next t lines describe each test case.

In a single line of each test case description, there is a single composite number n (4 ≤ n ≤ 10^9) — the number from the message.

It's guaranteed that the total number of divisors of n for all test cases does not exceed 2 ⋅ 10^5.

Output

For each test case in the first line output the initial order of divisors, which are greater than 1, in the circle. In the second line output, the minimal number of moves needed to decrypt the message.

If there are different possible orders with a correct answer, print any of them.

Example

Input


3
6
4
30


Output


2 3 6 
1
2 4 
0
2 30 6 3 15 5 10 
0

Note

In the first test case 6 has three divisors, which are greater than 1: 2, 3, 6. Regardless of the initial order, numbers 2 and 3 are adjacent, so it's needed to place their least common multiple between them. After that the circle becomes 2, 6, 3, 6, and every two adjacent numbers are not coprime.

In the second test case 4 has two divisors greater than 1: 2, 4, and they are not coprime, so any initial order is correct, and it's not needed to place any least common multiples.

In the third test case all divisors of 30 greater than 1 can be placed in some order so that there are no two adjacent numbers that are coprime.

Solution (in PYTHON3):

Solution:
def iinput():
    return [int(i) for i in input().split()]


def prime_factorization(x):
    factorization = []
    t = 2
    while t * t <= x:
        if not x % t:
            cur = 0
            while not x % t:
                x //= t
                cur += 1
            factorization.append([t, cur])
        t += 1
    if x > 1:
        factorization.append([x, 1])
    return factorization


def factors(prime_factors):
    factors1 = []
    for i in prime_factors:
        cur = []
        for j in range(i[1] + 1):
            cur += [i[0] ** j]
        factors1.append(cur)
    # print(factors1)
    while len(factors1) > 1:
        cur_f = factors1.pop()
        cur_s = factors1.pop()
        cur_th = []
        for i in cur_f:
            for j in cur_s:
                cur_th += [i * j]
        factors1.append(cur_th)
    # print(factors1)
    return factors1[0][1:]


t = int(input())
for _ in range(t):
    n = int(input())
    fact = prime_factorization(n)
    # print(fact)
    if len(fact) == 2 and fact[0][1] == fact[1][1] and fact[0][1] == 1:
        print(fact[0][0], fact[1][0], fact[0][0] * fact[1][0])
        print(1)
    elif len(fact) == 2 and (fact[0][1] == 1 or fact[1][1] == 1):
        all_factors = factors(fact)
        fact = [i[0] for i in fact]
        black_list = []
        # print(fact)
        # print(all_factors)
        ans = []
        lena = len(fact)
        extra = 0
        first = fact[0]
        second = fact[1]
        for i in range(lena):
            cur = fact[i]
            next = fact[(i + 1) % (lena)]
            black_list += [cur]
            black_list += [next]
        for i in all_factors:
            if i != first * second and not i % first and not i % second:
                extra = i
                black_list += [i]
                break
        # print(extra)
        # print(black_list)
        for i in range(lena):
            ans += [fact[i]]
            cur = fact[i]
            next = fact[(i + 1) % (lena)]
            for i in all_factors:
                if not i % cur and i not in black_list and i != cur * next:
                    ans += [i]
                    black_list += [i]
                    # print(i)
            if cur * next not in black_list:
                ans += [cur * next]
                black_list += [cur * next]
            else:
                ans += [extra]
        print(*ans)
        print(0)
    else:
        all_factors = factors(fact)
        fact = [i[0] for i in fact]
        black_list = []
        # print(fact)
        # print(all_factors)
        ans = []
        lena = len(fact)
        for i in range(lena):
            cur = fact[i]
            next = fact[(i + 1) % (lena)]
            black_list += [cur]
            black_list += [next]
            black_list += [cur * next]
        for i in range(lena):
            ans += [fact[i]]
            cur = fact[i]
            next = fact[(i + 1) % (lena)]
            for i in all_factors:
                if not i % cur and i not in black_list:
                    ans += [i]
                    black_list += [i]
            ans += [cur * next]
        print(*ans)
        print(0)

"""1
998511784
"""