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 JAVA):

Solution:
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.*;

public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        solve(in, out);
        out.close();
    }

    static String reverse(String s) {
        return (new StringBuilder(s)).reverse().toString();
    }

    static void sieveOfEratosthenes(int n, int factors[]) 
    { 
        factors[1]=1;
        for(int p = 2; p*p <=n; p++) 
        { 
            if(factors[p] == 0) 
            { 
                factors[p]=p;
                for(int i = p*p; i <= n; i += p) 
                    factors[i] = p; 
            } 
        } 
    }

    static void sort(int ar[]) {
        int n = ar.length;
        ArrayList<Integer> a = new ArrayList<>();
        for (int i = 0; i < n; i++)
            a.add(ar[i]);
        Collections.sort(a);
        for (int i = 0; i < n; i++)
            ar[i] = a.get(i);
    }

    static void sort1(long ar[]) {
        int n = ar.length;
        ArrayList<Long> a = new ArrayList<>();
        for (int i = 0; i < n; i++)
            a.add(ar[i]);
        Collections.sort(a);
        for (int i = 0; i < n; i++)
            ar[i] = a.get(i);
    }

    static long ncr(long n, long r, long mod) {
        if (r == 0)
            return 1;
        long val = ncr(n - 1, r - 1, mod);
        val = (n * val) % mod;
        val = (val * modInverse(r, mod)) % mod;
        return val;
    }

    public static void solve(InputReader sc, PrintWriter pw) {
        int i, j = 0;
        // int t = 1;  
        int t = sc.nextInt();
        u: while (t-- > 0) {
            int n = sc.nextInt();
            int lowest_prime = 2;
            for(i=2;1l*i*i<=n;i++){
                if(n%i==0){
                    lowest_prime = i;
                    break;
                }
            }
            ArrayList<Integer> primes = new ArrayList<>();
            ArrayList<Integer> factors = new ArrayList<>();
            for(i=2;1l*i*i<=n;i++){
                if(n%i==0&&isPrime(i)){
                    primes.add(i);
                }
                else if(n%i==0){
                    factors.add(i);
                }
                if(n%i==0&&n/i!=i){
                    if(isPrime(n/i)){
                        primes.add(n/i);
                    }
                    else{
                        factors.add(n/i);
                    }
                }
            }
            factors.add(n);
            // for(int y:factors){
            //     pw.println(" "+y);
            // }
            ArrayList<Integer> ar = new ArrayList<>();
            ar.add(lowest_prime);
            HashSet<Integer> taken = new HashSet<>();
            if(primes.size()>=2){
                ar.add(lowest_prime*primes.get(1));
                taken.add(lowest_prime*primes.get(1));
                ar.add(primes.get(1));
                primes.add(lowest_prime);
                taken.add(lowest_prime);
                int curr = primes.get(1);
                for(i=2;i<primes.size();i++){
                    int tar = curr * primes.get(i);
                    for(j=0;j<factors.size();j++){
                        if(factors.get(j)%curr==0){
                            int val = factors.get(j);
                            // pw.println(val+" "+j);
                            // pw.println("    "+factors.get(j));
                            factors.remove(j);
                            j--;
                            if(val!=tar&&val!=n&&!taken.contains(val)){
                                taken.add(val);
                                ar.add(val);
                            }
                        }
                    }
                    if(!taken.contains(tar)){
                        ar.add(tar);
                        taken.add(tar);
                    }
                    curr = primes.get(i);
                    if(!taken.contains(curr)){
                        ar.add(curr);
                        taken.add(curr);
                    }
                }
                if(!taken.contains(n)){
                    ar.add(n);
                }
                for(int y:factors){
                    ar.add(y);
                }
                for(i=0;i<ar.size();i++){
                    pw.print(ar.get(i)+" ");
                }
                int v = 0;
                for(i=0;i<ar.size()-1;i++){
                    if(gcd(ar.get(i),ar.get(i+1))==1){
                        v++;
                    }
                }
                if(gcd(ar.get(0),ar.get(ar.size()-1))==1){
                    v++;
                }
                pw.println();
                pw.println(v);
            }
            else{
                for(int y:factors){
                    ar.add(y);
                }
                for(i=0;i<ar.size();i++){
                    pw.print(ar.get(i)+" ");
                }
                pw.println();
                pw.println(0);
            }
            
        }
    }


    static class Pair implements Comparable<Pair> {
        int a;
        int b;
        // int c;
        
        Pair(int a, int b) {
            this.a = a;
            this.b = b;
        }
 
        public int compareTo(Pair p) {
            if(a!=p.a)
                return p.a-a;
            return b-p.b;
        }
    }

    static boolean isPrime(long n) {
        if (n <= 1)
            return false;
        if (n <= 3)
            return true;
        if (n % 2 == 0 || n % 3 == 0)
            return false;
        for (int i = 5; i * i <= n; i = i + 6)
            if (n % i == 0 || n % (i + 2) == 0)
                return false;
        return true;
    }

    static long gcd(long a, long b) {
        if (b == 0)
            return a;
        return gcd(b, a % b);
    }

    static long fast_pow(long base, long n, long M) {
        if (n == 0)
            return 1;
        if (n == 1)
            return base % M;
        long halfn = fast_pow(base, n / 2, M);
        if (n % 2 == 0)
            return (halfn * halfn) % M;
        else
            return (((halfn * halfn) % M) * base) % M;
    }

    static long modInverse(long n, long M) {
        return fast_pow(n, M - 2, M);
    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public long nextLong() {
            return Long.parseLong(next());
        }
    }
}