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.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.StringTokenizer;

/*
1 998863322
 */
public class problemE {
    private static void solve() throws Exception {
        int n = fs.nextInt();
        int N = n;

        ArrayList<ArrayList<Integer>> powers = new ArrayList<>();
        ArrayList<HashSet<Integer>> coprimes = new ArrayList<>();

        for (int p : primes) {
            if (n % p == 0) {
                ArrayList<Integer> pow = new ArrayList<>();
                for (int d = p ; n % d == 0 ; d = d * p) pow.add(d);
                n = n / pow.get(pow.size()-1);
                powers.add(pow);
                coprimes.add(divisors(n));
            } else if ( n < p) break;
        }
        if (n != 1) {
            ArrayList<Integer> pow = new ArrayList<>(1);
            pow.add(n);
            powers.add(pow);
            coprimes.add(divisors(1));
        }

        int count = 0;

        ArrayList<Integer> ans = new ArrayList<>();
        int plen = powers.size();
        for (int i = 0 ; i < plen; i++ ) {

            ans.addAll(powers.get(i));

            HashSet<Integer> fillers = new HashSet<>();
            for (int p : powers.get(i)) {
                for (int d : coprimes.get(i)) {
                    fillers.add(p * d);
                }
            }
            fillers.remove(N);
            int last = -1;
            if (i != plen-1) {
                last = powers.get(i+1).get(0) * powers.get(i).get(0);
                if (last == N) last = -1;
                fillers.remove(last);
            }
            ans.addAll(fillers);

            if (last != -1) {
                ans.add(last);
            }

            if (last == -1 && fillers.size() == 0 && i != plen-1) count++;
        }
        if (powers.size() != 1) { ans.add(N); }

        for (int x : ans) { out.print(x); out.print(' '); }
        out.println();
        out.println(count);
    }

    static HashSet<Integer> divisors(int n) {
        HashSet<Integer> divs = new HashSet<>();
        if (n != 1 ) divs.add(n);
        for (int i = 2; i*i <= n ; i ++ ) {
            if (n % i == 0) {
                divs.add(i);
                if (n/i != i) divs.add(n/i);
            }
        }
        return divs;
    }

    static ArrayList<Integer> primes = new ArrayList<>();
    static void init() {
        int MAX = (int) Math.ceil(Math.sqrt(1e9));
        boolean[] dp = new boolean[MAX+1];
        Arrays.fill(dp, true);
        for (int p = 2; p <= MAX; p++) {
            if (dp[p]) {
                primes.add(p);
                for (int j = p * p; j < MAX; j += p) dp[j] = false;
            }
        }
    }

    private static FastScanner fs = new FastScanner();
    private static PrintWriter out = new PrintWriter(System.out);

    public static void main(String[] args) throws Exception {
        int T = 1;
        init();
        T = fs.nextInt();
        for (int t = 0; t < T; t++) {
            solve();
        }
        out.close();
    }

    static void debug(Object... O) {
        System.err.print("DEBUG ");
        System.err.println(Arrays.deepToString(O));
    }

    static class FastScanner {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        StringTokenizer st = new StringTokenizer("");

        String next() {
            while (!st.hasMoreTokens())
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            return st.nextToken();
        }

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

        int[] readArray(int n) {
            int[] a = new int[n];
            for (int i = 0; i < n; i++) a[i] = nextInt();
            return a;
        }

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

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextString() {
            return next();
        }
    }
}