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.lang.*;
// StringBuilder uses java.lang
 
 
public class mC {
    
    
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int te = sc.nextInt();
        StringBuilder st = new StringBuilder();
        for (int test=0;test<te;test++) {
            int n = sc.nextInt();
            int t = n;
            ArrayList<Integer> primeFact = new ArrayList<>();
            int div = 2;
            //int at = 0;
            while (div<=(Math.sqrt(t)+0.1)) {
                if (t%div==0) {
                    primeFact.add(div);
                    t/=div;
                } else {
                    div++;
                }
            }
            if (t>1) {
                primeFact.add(t);
            }
 
            if (primeFact.size()==2 && primeFact.get(0)-primeFact.get(1)!=0) {
                st.append(primeFact.get(0)+" "+primeFact.get(1)+" "+n+"\n");
                st.append("1\n");
            } else {
                ArrayList<Integer> numTimes = new ArrayList<>();
                ArrayList<Integer> distinct = new ArrayList<>();
                int last = primeFact.get(0);
                int numTime = 0;
                for (int i=0; i<primeFact.size(); i++) {
                    if (last==primeFact.get(i)) {
                        numTime++;
                    } else {
                        numTimes.add(numTime);
                        numTime=1;
                        distinct.add(last);
                        last=primeFact.get(i);
                    }
                }
                numTimes.add(numTime);
                distinct.add(last);
                st.append(n+" ");
                ArrayList<ArrayList<Integer>> divList = new ArrayList<>();
                for (int i=0;i<=distinct.size();i++) {
                    ArrayList<Integer> temp = new ArrayList<>();
                    divList.add(temp);
                }
                divList.get(distinct.size()).add(1);
                for (int i=distinct.size()-1;i>=0;i--) {
                    for (int j=1;j<=numTimes.get(i);j++) {
                        int powe = fastPow(distinct.get(i),j);
                        for (int q=i+1;q<=distinct.size();q++) {
                            for (int k=0;k<divList.get(q).size();k++) {
                                int a = divList.get(q).get(k)*powe;
                                divList.get(i).add(a);
                            }
                        }
                    }
                }
 
                for (int i=0;i<distinct.size()-1;i++) {
                    for (int j=0;j<divList.get(i).size();j++) {
                        if (divList.get(i).get(j)!=n && divList.get(i).get(j)!=distinct.get(i)*distinct.get(i+1)) {
                            st.append(divList.get(i).get(j)+" ");
                        }
                    }
                    st.append(distinct.get(i)*distinct.get(i+1)+" ");
                }
                for (int j=0;j<divList.get(distinct.size()-1).size();j++) {
                    if (divList.get(distinct.size()-1).get(j)!=n) {
                        st.append(divList.get(distinct.size()-1).get(j)+" ");
                    }
                }
                st.append("\n0\n");
                
            }
        }
        System.out.print(st.toString());
        
    }
    
    public static int findNthInArray(int[] arr,int val,int start,int o) {
        if (o==0) {
            return start-1;
        } else if (arr[start] == val) {
            return findNthInArray(arr,val,start+1,o-1);
        } else {
            return findNthInArray(arr,val,start+1,o);
        }
    }
    public static ArrayList<Integer> dfs(int at,ArrayList<Integer> went,ArrayList<ArrayList<Integer>> connect) {
        for (int i=0;i<connect.get(at).size();i++) {
            if (!(went.contains(connect.get(at).get(i)))) {
                went.add(connect.get(at).get(i));
                went=dfs(connect.get(at).get(i),went,connect);
            }
        }
        return went;
    } public static int[] bfs (int at, int[] went, ArrayList<ArrayList<Integer>> queue, int numNodes, ArrayList<ArrayList<Integer>> connect) {
        if (went[at]==0) {
            went[at]=queue.get(numNodes).get(1);
            for (int i=0;i<connect.get(at).size();i++) {
                if (went[connect.get(at).get(i)]==0) {
                    ArrayList<Integer> temp = new ArrayList<>();
                    temp.add(connect.get(at).get(i));
                    temp.add(queue.get(numNodes).get(1)+1);
                    queue.add(temp);
                }
            }
            
        }
        if (queue.size()==numNodes+1) {
            return went;
        } else {
            return bfs(queue.get(numNodes+1).get(0),went, queue, numNodes+1, connect);
        }
    }
    public static long fastPow(int base,long exp,long mod) {
        if (exp==0) {
            return 1;
        } else {
            if (exp % 2 == 1) {
                long z = fastPow(base,(exp-1)/2,mod);
                return ((((z*base) % mod) * z) % mod);
            } else {
                long z = fastPow(base,exp/2,mod);
                return ((z*z) % mod);
            }
        }
    }
    public static int fastPow(int base,long exp) {
        if (exp==0) {
            return 1;
        } else {
            if (exp % 2 == 1) {
                int z = fastPow(base,(exp-1)/2);
                return ((((z*base)) * z));
            } else {
                int z = fastPow(base,exp/2);
                return ((z*z));
            }
        }
    }
    public static int firstLarger(int val,ArrayList<Integer> ok,int left,int right) {
        if (ok.get(right)<=val) {
            return -1;
        }
        if (left==right) {
            return left;
        } else if (left+1==right) {
            if (val<ok.get(left)) {
                return left;
            } else {
                return right;
            }
        } else {
            int mid = (left+right)/2;
            if (ok.get(mid)>val) {
                return firstLarger(val,ok,left,mid);
            } else {
                return firstLarger(val,ok,mid+1,right);
            }
        }
    }
}