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.PrintWriter;
import java.util.*;

public class Main extends PrintWriter {
    public Main() {
        super(System.out);
    }

    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        Main main = new Main();
        int n = s.nextInt();
        while (n-- > 0) {
            main.MainPrint(s);
        }
        main.flush();
    }
    List<int[]> list;
    List<Integer>[] ans1;
    private void MainPrint(Scanner s) {
        int n = s.nextInt();
        int nCopy = n;
        list = new ArrayList<>();
        int[] append;
        for (int i = 2; i*i <= nCopy; i++) {
            if(nCopy%i == 0){
                append = new int[]{i,0};
                list.add(append);
                while (nCopy%i==0){
                    append[1]++;
                    nCopy/=i;
                }
            }
        }

        if(nCopy!=1) list.add(new int[]{nCopy,1});
//        println(list.size());
        StringBuilder ans = new StringBuilder();
        if (list.size() == 1){
            for (int i = 1; i <= list.get(0)[1]; i++) {
                if(ans.length()!=0) ans.append(' ');
                ans.append((int)Math.pow(list.get(0)[0],i));
            }
            println(ans);
            println(0);
        }else if(list.size() == 2){
            if(list.get(0)[1]>=2){
                ans.append(list.get(0)[0]*list.get(1)[0]);
                for (int i = 1; i <= list.get(0)[1]; i++) {
                    for (int j = 0; j <= list.get(1)[1]; j++){
                        if((i == 1 || i == 2) && j ==1) continue;
                        ans.append(' ');
                        ans.append((int)Math.pow(list.get(0)[0],i)*(int)Math.pow(list.get(1)[0],j));
                    }
                }
                ans.append(' ');
                ans.append(list.get(0)[0]*list.get(1)[0]*list.get(0)[0]);
                for (int i = 1; i <= list.get(1)[1]; i++) {
                    ans.append(' ');
                    ans.append((int)Math.pow(list.get(1)[0],i));
                }
                println(ans);
                println(0);
            }else if (list.get(1)[1]>=2){
                ans.append(list.get(0)[0]*list.get(1)[0]);
                for (int i = 1; i <= list.get(0)[1]; i++) {
                    for (int j = 0; j <= list.get(1)[1]; j++){
                        if(i == 1 && (j == 1 || j == 2)) continue;
                        ans.append(' ');
                        ans.append((int)Math.pow(list.get(0)[0],i)*(int)Math.pow(list.get(1)[0],j));
                    }
                }
                ans.append(' ');
                ans.append(list.get(0)[0]*list.get(1)[0]*list.get(1)[0]);
                for (int i = 1; i <= list.get(1)[1]; i++) {
                    ans.append(' ');
                    ans.append((int)Math.pow(list.get(1)[0],i));
                }
                println(ans);
                println(0);
            }else {
                ans.append(list.get(0)[0]*list.get(1)[0]);
                ans.append(' ');
                ans.append(list.get(0)[0]);
                ans.append(' ');
                ans.append(list.get(1)[0]);
                println(ans);
                println(1);
            }

        }else {
            ans1 = new List[list.size()];
            for (int i = 0; i < ans1.length; i++) ans1[i] = new LinkedList<>();
            for (int i = 2; i*i <= n; i++){
                if(n%i==0){
                    add(i);
                    if(i*i!=n){
                        add(n/i);
                    }
                }
            }
            add(n);

            for (int i = 0; i<ans1.length;i++){
                if(ans.length()!=0) ans.append(' ');
                ans.append(list.get(i==0?ans1.length-1:i-1)[0]*list.get(i)[0]);
                for (int j:ans1[i]) {
                    ans.append(' ');
                    ans.append(j);
                }
            }

            println(ans);
            println(0);
        }
    }

    private void add(int i) {
        int p = 0;
        while(true) {
            if (i % list.get(p)[0] == 0 && i != list.get(p)[0] * list.get(p == list.size() - 1 ? 0 : p + 1)[0] && i != list.get(p)[0] * list.get(p == 0 ? list.size() - 1 : p - 1)[0]) {
                ans1[p].add(i);
                break;
            } else if (i % list.get(p)[0] != 0 && p != list.size() - 1) {
                p++;
            }else {
                break;
            }
        }
    }

}