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:
import math
t = int(input())
def printDivisors(curPrimes,curPrime,primeDict,forbidden,printed):
    l = len(curPrimes)
    num = 1
    for i in range(primeDict[curPrime]):
        num*=curPrime
        for j in range(l):
            temp = num*curPrimes[j]
            curPrimes.append(temp)
            if temp not in printed:
                print(int(temp), end = " ")
                printed[temp] = True
    return [curPrimes,printed]
    
for o in range(t):
    printed = {}
    m = int(input())
    primeList = []
    primeDict = {}
    for i in range(2,math.ceil(math.sqrt(m))+1):
        if m%i == 0:
            primeList.append(i)
            primeDict[i] = 0
            while m%i == 0:
                m = m/i
                primeDict[i] = primeDict[i] + 1
    if m != 1:
        primeList.append(m)
        primeDict[m] = 1
    isOne = False
    if len(primeList) == 2:
        if primeDict[primeList[0]] == 1 and primeDict[primeList[1]] == 1:
            isOne = True
    if isOne == True:
        print(int(primeList[1]),int(primeList[1]*primeList[0]),int(primeList[0]))
        print(1)
    elif len(primeList)<=2:
        if len(primeList) == 1:
            num = 1
            for i in range(primeDict[primeList[0]]):
                num *= primeList[0]
                print(int(num), end = " ")
            print()
            print(0)
        else:
            primeOne = primeList[0]
            primeTwo = primeList[1]
            forbidden1 = 0
            forbidden2 = 0
            if primeDict[primeOne] != 1:
                forbidden1 = primeOne*primeTwo
                forbidden2 = primeOne*primeTwo*primeOne
            else:
                forbidden1 = primeOne*primeTwo
                forbidden2 = primeOne*primeTwo*primeTwo
            print(int(forbidden1),end = " ")
            printed[forbidden1] = True
            d = [1]
            for i in range(primeDict[primeOne]):
                t = d[-1]*primeOne
                d.append(t)
                if t not in printed:
                    print(int(t), end = " ")
                printed[t] = True
            print(int(forbidden2),end = " ")
            printed[forbidden2] = True
            cur = 1
            for i in range(primeDict[primeTwo]):
                cur *= primeTwo
                for j in d:
                    temp = int(cur*j)
                    if temp not in printed:
                        print(temp,end = " ")
                        printed[temp] = True
            print()
            print(0)
    else:
        curPrimes = [1]
        for i in range(len(primeList)-1,-1,-1):
            curPrime = primeList[i]
            forbidden = 0
            if i == len(primeList)-1:
                forbidden = curPrime*primeList[0]
            else:
                forbidden = curPrime*primeList[i+1]
            print(int(forbidden),end = " ")
            printed[forbidden] = True
            ret = printDivisors(curPrimes,curPrime,primeDict,forbidden,printed)
            curPrimes = ret[0]
            printed = ret[1]
        print()
        print(0)