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:
from collections import defaultdict

def setup():
    import os, sys
    dir_path = os.path.dirname(os.path.realpath(__file__))
    sys.stdin = open(os.path.join(dir_path, "input.txt"), 'r')
    sys.stdout = open(os.path.join(dir_path, "output.txt"), 'w')
#setup()

# sqrt(n)
def divisors(n: int) -> list:
    divisors = []
    i = 1
    while i * i < n:
        if n % i == 0:
            divisors.append(i)
        i += 1
    if i * i == n:
        divisors.append(i)
    prev_i = i-1
    for i in range(prev_i, 0, -1):
        if n % i == 0:
            divisors.append(n//i)
    return divisors

# sqrt(n)
def prime_factors(n: int) -> list:
    s = []
    i = 2
    while (i * i <= n):
        if n % i == 0:
            n //= i
            if not s or s[-1] != i:
                s.append(i)
        else:
            i += 1
    if n > i:
        s.append(n)
    return s

# O(nlogn) will pass
# All divisors of n greater than 1 are placed in some circle in any config we like
# can insert lcm of two numbers in between
# decrypted if every gcd(a_i, a_(i+1)) > 1

# claim: don't need to insert lcm unless of the form p*q
# given an sorted list of primes: [p_1, ..., p_n]
# put   p_np_1, p_1, (all unused multiples of p_1 except p_1p_n or p_1p_2), 
#       p_1p_2, p_2, (all unused multiples of p_2 except p_2p_3), 
#       p_2p_3, ..., 
#       p_(n-1)p_n, p_n, (all unused multiples of p_n except p_np_1)

# for n = 2, p_1, (sorted multiples of p_1p_2 excluding p_1p_2, largest factor must divide p_2), p_2, p_1p_2

# breaks for only primes p_1, p_2 each occuring once
# 2, 4, 12, 3, 6, ...
# this uses all multiples of p_1, ..., p_n, etc.

# how to pick unused multiples: map each number to their smallest prime factor
# for each divisor, you can get spf in O(10)

def solve(n):
    # these are sorted
    primes = prime_factors(n)
    divs = divisors(n)[1:]

    # all powers of same prime
    if len(primes) == 1: return divs, 0
    if len(primes) == 2:
        # only one of each prime, needs a lcm move
        if len(divs) == 3: return divs, 1

        # at least one prime occurs more than once, assume that is p1
        p0, p1 = primes
        if n % (p0)**2 == 0:
            p0, p1 = p1, p0
        divs = [i for i in divs if i not in {p0, p1, p0 * p1, p0 * (p1)**2}]
        return [p0, p0 * (p1**2)] + divs + [p1, p0 * p1], 0

    # maps each divisor to their spf
    div_to_spf = {d: prime for d in divs for prime in primes[::-1] if d % prime == 0}

    # exclude p[i] * p[i+1] and p[i] for "unused multiples"
    for i in range(len(primes)):
        del div_to_spf[primes[i]]
        div_to_spf.pop(primes[i] * primes[i-1], None)

    # maps each prime to list of unused divisors
    spf_to_div = defaultdict(list)
    for div, spf in div_to_spf.items():
        spf_to_div[spf].append(div)

    ans = []
    for i in range(len(primes)):
        ans.append(primes[i] * primes[i-1])
        ans.append(primes[i])
        ans.extend(spf_to_div[primes[i]])
    return ans, 0


# solve(n) = 1e6 runtime
for _ in range(int(input())):
    arr, num = solve(int(input()))
    print(' '.join(list(map(str, arr))))
    print(num)