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:
/**
 * author: derrick20
 * created: 9/20/20 1:32 PM
 */
import java.io.*;
import java.util.*;

public class Decryption implements Runnable {
    public static void main(String[] args) throws Exception {
        new Thread(null, new Decryption(), ": )", 1 << 28).start();
    }

    public void run() {
        FastScanner sc = new FastScanner();
        PrintWriter out = new PrintWriter(System.out);

        int T = sc.nextInt();
        while (T-->0) {
            int N = sc.nextInt();
            TreeMap<Integer, Integer> primes = new TreeMap<>();
            ArrayList<Integer> divs = new ArrayList<>();
            divs.add(N);
            int total = 0;
            int curr = N;
            int unique = 0;
            for (int i = 2; i * i <= N; i++) {
                if (curr % i == 0) {
                    unique++;
                    int ct = 0;
                    while (curr % i == 0) {
                        curr /= i;
                        ct++;
                    }
                    primes.put(i, ct);
                    total += ct;
                }
                if (N % i == 0) {
                    divs.add(i);
                    if (i * i != N) {
                        divs.add(N / i);
                    }
                }
            }
            if (curr > 1) {
                unique++;
                total++;
                primes.put(curr, 1);
            }

            if (total == 2 && unique == 2) {
                /*
                Any case aside from this can be proven to work
                 */
                int a = primes.firstKey();
                int b = primes.lastKey();
                out.println(a + " " + a * b + " " + b);
                out.println(1);
            } else {
                /*
                Now, we know there are >= 3 primes (counting duplicates)
                 */
                int a = primes.firstKey();
                int ct = primes.get(a);
                primes.pollFirstEntry();
                ArrayList<Integer> constr = new ArrayList<>();
                constr.add(a);
                // Let's do a simple base case, just to have the first prime.
                // General idea: leave more work for the recursive steps to handle
                for (int i = 0; i < ct - 1; i++) {
                    constr.add(a * constr.get(i));
                }
                while (primes.size() > 0) {
                    int p = primes.firstKey();
                    ct = primes.get(p);
                    primes.pollFirstEntry();
                    ArrayList<Integer> copy = new ArrayList<>();
                    int mult = p;
                    for (int it = 0; it < ct; it++) {
                        // Each round, we mirror the circle by copying the original, scaling by mult
                        for (int j = constr.size() - 1; j >= 0; j--) {
                            copy.add(mult * constr.get(j));
                        }
                        /*
                         Insert the p^k term right before end, to wedge it within the good zone
                         An edge case can happen when we have only 2 primes so far
                         Ex: constr = [2], copy = [3, 6] is what results if we insert 3^1 before the end
                         However, inserting it as [6, 3] WILL work. This is because we know there are
                         more primes that'll be used to mirror and append, which will essentially allow us
                         to glue each end to p * itself which will always work
                         Ex: [2, 6, 3] + [15, 30, *5*, 10] (adding p = 5)
                         The insertion of 5^1 could be anywhere in the middle, but the end is simple.
                         We can repeat this for a given prime for however many powers it has
                        */
                        copy.add(Math.max(1, copy.size() - 1), mult);
                        mult *= p; // move to the next power
                    }
                    constr.addAll(copy);
                }
                ASSERT(constr.size() == divs.size());
                StringBuilder ans = new StringBuilder();
                for (int v : constr)
                    ans.append(v).append(" ");
                out.println(ans);
                out.println(0);
            }
        }
        out.close();
    }

    static int gcd(int a, int b) {
        return b == 0 ? a : gcd(b, a % b);
    }

    static class FastScanner {
        private int BS = 1 << 16;
        private char NC = (char) 0;
        private byte[] buf = new byte[BS];
        private int bId = 0, size = 0;
        private char c = NC;
        private double cnt = 1;
        private BufferedInputStream in;

        public FastScanner() {
            in = new BufferedInputStream(System.in, BS);
        }

        public FastScanner(String s) {
            try {
                in = new BufferedInputStream(new FileInputStream(new File(s)), BS);
            } catch (Exception e) {
                in = new BufferedInputStream(System.in, BS);
            }
        }

        private char getChar() {
            while (bId == size) {
                try {
                    size = in.read(buf);
                } catch (Exception e) {
                    return NC;
                }
                if (size == -1) return NC;
                bId = 0;
            }
            return (char) buf[bId++];
        }

        public int nextInt() {
            return (int) nextLong();
        }

        public int[] nextInts(int N) {
            int[] res = new int[N];
            for (int i = 0; i < N; i++) {
                res[i] = (int) nextLong();
            }
            return res;
        }

        public long[] nextLongs(int N) {
            long[] res = new long[N];
            for (int i = 0; i < N; i++) {
                res[i] = nextLong();
            }
            return res;
        }

        public long nextLong() {
            cnt = 1;
            boolean neg = false;
            if (c == NC) c = getChar();
            for (; (c < '0' || c > '9'); c = getChar()) {
                if (c == '-') neg = true;
            }
            long res = 0;
            for (; c >= '0' && c <= '9'; c = getChar()) {
                res = (res << 3) + (res << 1) + c - '0';
                cnt *= 10;
            }
            return neg ? -res : res;
        }

        public double nextDouble() {
            double cur = nextLong();
            return c != '.' ? cur : cur + nextLong() / cnt;
        }

        public double[] nextDoubles(int N) {
            double[] res = new double[N];
            for (int i = 0; i < N; i++) {
                res[i] = nextDouble();
            }
            return res;
        }

        public String next() {
            StringBuilder res = new StringBuilder();
            while (c <= 32) c = getChar();
            while (c > 32) {
                res.append(c);
                c = getChar();
            }
            return res.toString();
        }

        public String nextLine() {
            StringBuilder res = new StringBuilder();
            while (c <= 32) c = getChar();
            while (c != '\n') {
                res.append(c);
                c = getChar();
            }
            return res.toString();
        }

        public boolean hasNext() {
            if (c > 32) return true;
            while (true) {
                c = getChar();
                if (c == NC) return false;
                else if (c > 32) return true;
            }
        }
    }
    static void ASSERT(boolean assertion, String message) {
        if (!assertion) throw new AssertionError(message);
    }
    static void ASSERT(boolean assertion) {
        if (!assertion) throw new AssertionError();
    }
}