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.*;
import java.util.*;
 
public class Solution extends PrintWriter {
    
    ArrayList<Integer> factors = new ArrayList<Integer>();
    ArrayList<Integer> exps = new ArrayList<Integer>();

    void factors(int n) {
        factors.clear();
        exps.clear();
        for (int i = 2; i * i <= n; i++) {
            if (n % i == 0)
                factors.add(i);
            else continue;
            int cnt = 0;
            while (n % i == 0) {
                n /= i;
                cnt++;
            }
            exps.add(cnt);
        }
        if (n > 1) {
            factors.add(n);
            exps.add(1);
        }
    }
    

    TreeSet<Integer> divisors = new TreeSet<Integer>();
    
    void divisors(int n) {
        divisors.clear();
        for(int d = 2; d*d <= n; d++) {
            if(n%d == 0) {
                int dd = n/d;
                divisors.add(d);
                if(d != dd) divisors.add(dd);
            }
        }
        divisors.add(n);
    }
    
    private void solve() {
        int t = sc.nextInt();
        for(int tt = 1; tt <= t; tt++) {
            int n = sc.nextInt();
            factors(n);
            divisors(n);
            if(factors.size() == 2) {
                if(divisors.size() == 3) {
                    for(int x : divisors) {
                        print(x + " ");
                    }
                    println();
                    println(1);
                } else {
                    ArrayDeque<Integer> p1 = new ArrayDeque<>();
                    ArrayDeque<Integer> p2 = new ArrayDeque<>();
                    for(int x : divisors) {
                        if(x % factors.get(0) == 0) {
                            p1.add(x);
                        } else {
                            p2.add(x);
                        }
                    }
                    print(p1.removeLast() + " ");
                    for(int x : p1) {
                        print(x + " ");
                    }
                    for(int x : p2) {
                        print(x + " ");
                    }
                    println();
                    println(0);
                }
            } else {
                int save = factors.get(0)*factors.get(factors.size()-1);
                divisors.remove(save);
                for(int i = 0; i < factors.size(); i++) {
                    int p1 = factors.get(i);
                    int pow = 1;
                    for(int j = 0; j < exps.get(i); j++) {
                        pow *= p1;
                        print(pow + " ");
                        divisors.remove(pow);
                    }
                    int p2 = factors.get((i+1)%factors.size());
                    ArrayDeque<Integer> remove = new ArrayDeque<>();
                    int last = p1*p2;
                    for(int x : divisors) {
                        if(x%p1 == 0) {
                            if(x != last)
                                print(x + " ");
                            remove.add(x);
                        }
                    }
                    if(i < factors.size()-1)
                        print(last + " ");
                    for(int x : remove) {
                        divisors.remove(x);
                    }
                }
                if(factors.size() > 1)
                    print(save + " ");
                println();
                println(0);                
            }
        }
    }
    
//  Solution() throws FileNotFoundException { super(new File("output.txt")); }
//  InputReader sc = new InputReader(new FileInputStream("test_input.txt"));
  Solution() { super(System.out); }
  InputReader sc = new InputReader(System.in);
  static class InputReader {
      InputReader(InputStream in) { this.in = in; } InputStream in;
      
      private byte[] buf = new byte[16384];
      private int    curChar;
      private int    numChars;
      
 
      public int read() {
          if (numChars == -1)
              throw new InputMismatchException();
          if (curChar >= numChars) {
              curChar = 0;
              try {
                  numChars = in.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 nextString() {
          int c = read();
          while (isSpaceChar(c))
              c = read();
          StringBuilder res = new StringBuilder();
          do {
              res.appendCodePoint(c);
              c = read();
          } while (!isSpaceChar(c));
          return res.toString();
      }
 
      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;
      }
 
      private boolean isSpaceChar(int c) {
          return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
      }
 
      private boolean isEndOfLine(int c) {
          return c == '\n' || c == '\r' || c == -1;
      }
  }
 
    public static void main(String[] $) {
        new Thread(null, new Runnable() {
            public void run() {
                long start = System.nanoTime();
                try {Solution solution = new Solution(); solution.solve(); solution.flush();} 
                catch (Exception e) {e.printStackTrace(); System.exit(1);}
                System.err.println((System.nanoTime()-start)/1E9);
            }
        }, "1", 1 << 27).start();
 
    }
    

}