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 E671{

	public static void main(String args[]){
		FastReader sc = new FastReader();
		StringBuilder sb=new StringBuilder();
		int t,i,n;
		t=sc.nextInt();
		while(t-->0){
			n=sc.nextInt();
			ArrayList<Long> pr=new ArrayList<Long>();
			ArrayList<Long> fac=new ArrayList<Long>();
			HashSet<Long> set=new HashSet<>();
			int f1,f2;
			for(i=2;i<=Math.sqrt(n);i++){
				if(n%i==0){
					f1=i;
					f2=n/i;
					if(f1==f2){
						if(isPrime(f1)){
							pr.add((long)f1);
						}
						else 
							fac.add((long)f1);

					}
					else{
						if(isPrime(f1))
							pr.add((long)f1);
						else 
							fac.add((long)f1);
						if(isPrime(f2))
							pr.add((long)f2);
						else 
							fac.add((long)f2);
					}
				}
			}
			fac.add((long)n);
			if(pr.size()==2 && n== pr.get(0)*pr.get(1)){
				sb.append(pr.get(0)+" "+n+" "+pr.get(1)).append('\n');
				sb.append(1).append('\n');
				continue;
			}
			long num1,num2,num;
			for(i=0;i<pr.size();i++){
				num1=pr.get(i);
				num2=pr.get((i+1)%pr.size());
				num=num1*num2;
				set.add(num);
			}
			HashSet<Long> set2=new HashSet<>();
			for(i=0;i<pr.size();i++){
				num1=pr.get(i);
				num2=pr.get((i+1)%pr.size());
				num=num1*num2;
				sb.append(num1).append(' ');
				set.add(num1);
				for(long x:fac){
					if(!set.contains(x) && x%num1==0 && x%num2!=0){
						sb.append(x).append(' ');
						set.add(x);
					}
				}
				if(!set2.contains(num)){
					sb.append(num).append(' ');
					set2.add((long)num);
				}
			}
			for(long x: fac){
				if(!set2.contains(x)&&!set.contains(x))
					sb.append(x).append(' ');
			}
			sb.deleteCharAt(sb.length()-1);
			sb.append('\n');
			sb.append(0).append('\n');
		}
		sb.deleteCharAt(sb.length()-1);
		out.println(sb);
	}

	static PrintWriter out;
	static class FastReader{
		BufferedReader br;
		StringTokenizer st;
		public FastReader(){
			br=new BufferedReader(new InputStreamReader(System.in));
			out=new PrintWriter(System.out,true);
		}
		String next(){
			while(st==null || !st.hasMoreElements()){
				try{
					st= new StringTokenizer(br.readLine());
				}
				catch (IOException e){
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}
		int nextInt(){
			return Integer.parseInt(next());
		}
		long nextLong(){
			return Long.parseLong(next());
		}
		double nextDouble(){
			return Double.parseDouble(next());
		}
		String nextLine(){
			String str = "";
			try{
				str=br.readLine();
			}
			catch(IOException e){
				e.printStackTrace();
			}
			return str;
		}
	}

	public static boolean isPrime(int n) {
		if(n<2) return false;
		for(int i=2;i<=(int)Math.sqrt(n);i++) {
			if(n%i==0) return false;
		}
		return true;
	}

	public static void print(int a[],int l,int r){
		int i;
		for(i=l;i<=r;i++)
			out.print(a[i]+" ");
		out.println();
	}

	public static long fastexpo(long x, long y, long p){
		long res=1;
		while(y > 0){
			if((y & 1)==1)
				res= ((res%p)*(x%p))%p;
			y= y >> 1;			
			x = ((x%p)*(x%p))%p;
		}
		return res;
	}

	public static boolean[] sieve (int n) {
		boolean primes[]=new boolean[n+1];
		Arrays.fill(primes,true);
		primes[0]=primes[1]=false;
		for(int i=2;i*i<=n;i++){
			if(primes[i]){
				for(int j=i*i;j<=n;j+=i)
					primes[j]=false;
			}
		}
		return primes;
	}

	public static long gcd(long a,long b){
		return (BigInteger.valueOf(a).gcd(BigInteger.valueOf(b))).longValue();
	}

	public static void merge(long a[],int l,int m,int r){
		int n1,n2,i,j,k;
		n1=m-l+1;
		n2=r-m;

		long L[]=new long[n1];
		long R[]=new long[n2];

		for(i=0;i<n1;i++)
			L[i]=a[l+i];
		for(j=0;j<n2;j++)
			R[j]=a[m+1+j];

		i=0;j=0;

		k=l;
		while(i<n1&&j<n2){
			if(L[i]<=R[j]){
				a[k]=L[i];
				i++;
			}
			else{
				a[k]=R[j];
				j++;
			}
			k++;
		}

		while(i<n1){
			a[k]=L[i];
			i++;
			k++;
		}
		while(j<n2){
			a[k]=R[j];
			j++;
			k++;
		}
	}
	public static void sort(long a[],int l,int r){
		int m;
		if(l<r){
			m=(l+r)/2;
			sort(a,l,m);
			sort(a,m+1,r);
			merge(a,l,m,r);
		}
	}
}