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.util.*;
import java.io.*;
import java.math.*;
 
public class Main {
    static PrintWriter out;
    static Reader in;
    public static void main(String[] args) throws IOException {
        //out = new PrintWriter(new File("out.txt"));
        //PrintWriter out = new PrintWriter(System.out);
        //in = new Reader(new FileInputStream("in.txt"));
        //Reader in = new Reader();
        input_output();
        Main solver = new Main();
        solver.solve();
        out.flush();
        out.close();
 
    }
 
    static long INF = (long)1e16;
    static int maxn = (int)2e5+5;
    static int mod= 998_244_353;
    static int n, m, q, k, t;
    
    static int[] min;
    static Map<Integer, Integer> map;

    void solve() throws IOException{
        t = in.nextInt();

        min = new int[maxn];
        while (t --> 0) {
            n = in.nextInt();

            int a = n;
            map = new HashMap<Integer, Integer>();
            ArrayList<Integer> prim = new ArrayList<>();
            int[] cnt = new int[30];
            int cprimes = 0;

            ArrayList<Integer> div = new ArrayList<>();

            for (int i = 2; i <= Math.sqrt(n); i++) {
                if (n%i != 0) continue;

                if (a%i == 0) {
                    prim.add(i);
                    cprimes++;
                    while (a%i == 0) {
                        a/=i;
                        cnt[prim.size()-1]++;
                    }
                } else {
                    div.add(i);
                    map.put(i, div.size()-1);
                }

                if (n/i != i) {
                    div.add(n/i);
                    map.put(n/i, div.size()-1);
                }
            }

            if (a != 1) {
                prim.add(a);
                cprimes++;
                cnt[prim.size()-1]++;
            }

            for (int i = 0; i < div.size(); i++) {
                for (int j = 0; j < prim.size(); j++) {
                    if (div.get(i)%prim.get(j) == 0) {
                        min[i] = prim.get(j);
                        break;
                    }
                }
            }

            if (cprimes == 1) {
                int tmp = prim.get(0);
                out.print(tmp);
                for (int i = 2; i <= cnt[0]; i++) {
                    tmp = tmp*prim.get(0);
                    out.print(" "+tmp);
                }
                out.println();
                out.println(0);
                continue;
            }

            ArrayList<Integer> ans = new ArrayList<>();

            if (cprimes == 2) {
                int elm = prim.get(0);
                for (int i = 1; i <= cnt[0]; i++) {
                    ans.add(elm);
                    elm *= prim.get(0);
                }
                int elmm = 1;
                for (int i = 0; i < div.size(); i++) {
                    elmm = div.get(i);
                    while (elmm%min[i] == 0) elmm/=min[i];
                    if (div.get(i) != a && elmm != 1) {
                        ans.add(div.get(i));
                    }
                }
                elm = prim.get(1);
                for (int i = 1; i <= cnt[1]; i++) {
                    ans.add(elm);
                    elm *= prim.get(1);
                }
                ans.add(n);
            } else {
                ArrayList<Integer> list[] = new ArrayList[30];
                ArrayList<Integer> first[] = new ArrayList[30];
                for (int i = 0; i < 30; i++) {
                    list[i] = new ArrayList<Integer>();
                    first[i] = new ArrayList<Integer>();
                }
                TreeSet<Integer> set = new TreeSet<>();


                for (int i = 0; i < div.size(); i++) {
                    if (div.get(i) == a) continue;
                    
                    boolean flag = false;
                    for (int j = 0; j < prim.size(); j++) {
                        int xx = j, yy = (j+1)%prim.size();
                        xx = prim.get(xx); yy = prim.get(yy);
                        if (div.get(i)%(xx*yy) == 0) {
                            list[j].add(div.get(i));
                            flag = true;
                            break;
                        }
                    }
                    if (!flag) {
                        for (int j = 0; j < prim.size(); j++) {
                            if (div.get(i)%prim.get(j) == 0) {
                                first[j].add(div.get(i));
                                break;
                            }
                        }
                    }
                }

                for (int i = 0; i < prim.size(); i++) {
                    int elm = prim.get(i);
                    for (int j = 1; j <= cnt[i]; j++) {
                        ans.add(elm);
                        set.add(elm);
                        elm *= prim.get(i);
                    }
                    for (int z = 0; z < first[i].size(); z++) {
                        if(!set.contains(first[i].get(z))) {
                            set.add(first[i].get(z));
                            ans.add(first[i].get(z));
                        }
                    }
                    for (int z = 0; z < list[i].size(); z++) {
                        if (!set.contains(list[i].get(z))) {
                            ans.add(list[i].get(z));
                        }
                    }
                }
                ans.add(n);
            }

            int finalans = 0;
            for (int i = 0; i < ans.size(); i++) {
                out.print(ans.get(i)+" ");
                int xx = i, yy = (i+1)%ans.size();
                xx = ans.get(i); yy = ans.get(yy);
                //out.println("gcd : "+xx+" "+yy+" "+gcd(xx, yy));
                if (gcd(xx, yy) == 1) finalans++;
            }
            out.println();
            out.println(finalans);
        }
    }

    //<>

    static int getKey(int x) {
        int key = min[map.get(x)];
        while (x%key == 0) x/=key;
        if (map.get(x) == null) return key*x;
        else return key*min[map.get(x)];
    }

    static int gcd(int x, int y) {
        if (x == 0) return y;
        if (y == 0) return x;
        return gcd(y%x, x);
    }

    static class Reader {
 
        private InputStream mIs;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;
    
        public Reader() {
            this(System.in);
        }
    
        public Reader(InputStream is) {
            mIs = is;
        }
    
        public int read() {
            if (numChars == -1) {
                throw new InputMismatchException();
    
        }
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = mIs.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }
    
        public String nextLine() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = read();
            } while (!isEndOfLine(c));
            return res.toString();
        }
    
        public String next() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = read();
            } while (!isSpaceChar(c));
            return res.toString();
        }
    
        double nextDouble()
        {
            return Double.parseDouble(next());
        }
    
        public long nextLong() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            long res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }
    
        public int nextInt() {
            int c = read();
            while (isSpaceChar(c)) {
                c = read();
            }
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }
    
        public boolean isSpaceChar(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }
    
        public boolean isEndOfLine(int c) {
            return c == '\n' || c == '\r' || c == -1;
        }
 
    }
    static void input_output() throws IOException {
        File f = new File("in.txt");
        if(f.exists() && !f.isDirectory()) { 
            in = new Reader(new FileInputStream("in.txt"));
        } else in = new Reader();
        f = new File("out.txt");
        if(f.exists() && !f.isDirectory()) {
            out = new PrintWriter(new File("out.txt"));
        } else out = new PrintWriter(System.out);
    }
}