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<>();
            TreeSet<Integer> unique = new TreeSet<>();
            ArrayList<Integer> divs = new ArrayList<>();
            divs.add(N);
            int total = 0;
            int curr = N;
            for (int i = 2; i * i <= N; i++) {
                if (curr % i == 0) {
                    unique.add(i);
                    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.add(curr);
                total++;
                primes.put(curr, 1);
            }
            if (total <= 2) {
                ASSERT(total == 2);
                StringBuilder ans = new StringBuilder();
                for (int v : divs)
                    ans.append(v).append(" ");
                out.println(ans);
                out.println(unique.size() == 2 ? 1 : 0); // unique should be >= 2, otherwise it's p^2
            } else {
//                System.out.println(primes);
                int a = primes.firstKey();
                int ct = primes.get(a);
                primes.pollFirstEntry();
                ArrayList<Integer> constr = new ArrayList<>();
                constr.add(a);
                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 right before end, to wedge it within the good zone
                        copy.add(Math.max(1, copy.size() - 1), mult);
                        mult *= p; // move to the next power
//                        System.out.println(copy);
                    }
                    constr.addAll(copy);
                }
//                System.out.println(constr);
                ASSERT(constr.size() == divs.size());
                StringBuilder ans = new StringBuilder();
                for (int v : constr)
                    ans.append(v).append(" ");
//                for (int i = 0; i < constr.size(); i++) {
//                    int g = gcd(constr.get(i), constr.get((i + 1) % constr.size()));
//                    System.out.println(g);
//                }
                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();
    }
}