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:
/*
If you want to aim high, aim high
Don't let that studying and grades consume you
Just live life young
******************************
What do you think? What do you think?
1st on Billboard, what do you think of it
Next is a Grammy, what do you think of it
However you think, I’m sorry, but shit, I have no fcking interest
*******************************
I'm standing on top of my Monopoly board
That means I'm on top of my game and it don't stop
til my hip don't hop anymore
https://www.a2oj.com/Ladder16.html
*******************************
300iq as writer = Sad!
*/
import java.util.*;
import java.io.*;
import java.math.*;

   public class D
   {
      public static void main(String hi[]) throws Exception
      {
         BufferedReader infile = new BufferedReader(new InputStreamReader(System.in));
         StringTokenizer st = new StringTokenizer(infile.readLine());
         int T = Integer.parseInt(st.nextToken());
         StringBuilder sb = new StringBuilder();
         while(T-->0)
         {
            int N = Integer.parseInt(infile.readLine());
            ArrayList<Integer> divs = findDiv(N);
            if(uno(divs))
            {
               for(int d: divs)
                  sb.append(d+" ");
               sb.append("\n");
               sb.append("0\n");
            }
            else
            {
               if(divs.size() == 3)
               {
                  for(int d: divs)
                     sb.append(d+" ");
                  sb.append("\n");
                  sb.append("1\n");
               }
               else
               {
                  ArrayList<Integer> primes = new ArrayList<Integer>();
                  for(int d: divs)
                     if(isPrime(d))
                        primes.add(d);
                  int[] links = new int[primes.size()];
                  for(int i=0; i < primes.size()-1; i++)
                  {
                     int next = primes.get(i)*primes.get(i+1);
                     links[i] = next;
                  }
                  links[primes.size()-1] = N;
                  divs = prune(divs, links, primes);
                  int dex = 0;
                  for(int p: primes)
                  {
                     sb.append(p+" ");
                     ArrayList<Integer> keep = new ArrayList<Integer>();
                     for(int d: divs)
                     {
                        if(d%p == 0)
                           sb.append(d+" ");
                        else
                           keep.add(d);
                     }
                     divs = keep;
                     sb.append(links[dex++]+" ");
                  }
                  sb.append("\n");
                  sb.append("0\n");
               }
            }
         }
         System.out.print(sb);
      }
      public static ArrayList<Integer> prune(ArrayList<Integer> divs, int[] links, ArrayList<Integer> primes)
      {
         HashSet<Integer> seen = new HashSet<Integer>();
         for(int x: primes)
            seen.add(x);
         for(int x: links)
            seen.add(x);
         ArrayList<Integer> newt = new ArrayList<Integer>();
         for(int x: divs)
            if(!seen.contains(x))
               newt.add(x);
         return newt;
      }
      public static boolean uno(ArrayList<Integer> divs)
      {
         long curr = 1L;
         for(int i=0; i < divs.size(); i++)
         {
            curr *= divs.get(0);
            if(curr != divs.get(i))
               return false;
         }
         return true;
      }
      public static ArrayList<Integer> findDiv(int N)
      {
         //gens all divisors of N
         ArrayList<Integer> ls1 = new ArrayList<Integer>();
         ArrayList<Integer> ls2 = new ArrayList<Integer>();
         for(int i=1; i <= (int)(Math.sqrt(N)+0.00000001); i++)
            if(N%i == 0)
            {
               if(i != 1)
                  ls1.add(i);
               ls2.add(N/i);
            }
         Collections.reverse(ls2);
         for(int b: ls2)
            if(b != ls1.get(ls1.size()-1))
               ls1.add(b);
         return ls1;
      }
      public static boolean isPrime(long n) 
      {
          if(n < 2) return false;
          if(n == 2 || n == 3) return true;
          if(n%2 == 0 || n%3 == 0) return false;
          long sqrtN = (long)Math.sqrt(n)+1;
          for(long i = 6L; i <= sqrtN; i += 6) {
              if(n%(i-1) == 0 || n%(i+1) == 0) return false;
          }
          return true;
      }
   }