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.*;

public class CFA {
  BufferedReader br;
  PrintWriter out;
  StringTokenizer st;
  boolean eof;
  private static final long MOD = 1000L * 1000L * 1000L + 7;
  private static final int[] dx = {0, -1, 0, 1};
  private static final int[] dy = {1, 0, -1, 0};
  private static final String yes = "Yes";
  private static final String no = "No";

  void solve() {
    int T = nextInt();
//    int T = 1;
    for (int i = 0; i < T; i++) {
        helper();
    }
  }

  void helper() {
    int n = nextInt();
    List<Integer> primes = factor(n);
    List<Integer> factors = new ArrayList<>();
    for (int i = 2; i * i <= n; i++) {
      if (n % i == 0) {
        if (i * i == n) {
          factors.add(i);
        } else {
          factors.add(i);
          factors.add(n / i);
        }
      }
    }
    factors.add(n);

    List<Integer> res = new ArrayList<>();
    if (primes.size() == 1) {
      res.addAll(factors);
    } else if (primes.size() == 2) {
      List<Integer> p1 = new ArrayList<>();
      List<Integer> p12 = new ArrayList<>();
      List<Integer> p2 = new ArrayList<>();
      for (int v : factors) {
        if (v % primes.get(0) == 0) {
          if (v % primes.get(1) == 0) {
            p12.add(v);
          } else {
            p1.add(v);
          }
        } else {
          p2.add(v);
        }
      }
      res.addAll(p1);
      res.add(p12.get(0));
      res.addAll(p2);
      for (int i = 1; i < p12.size(); i++) {
        res.add(p12.get(i));
      }
    } else {
      // Find pi * pj
      Set<Integer> primeMul = new HashSet<>();
      for (int i = 0; i < primes.size(); i++) {
        int p1 = primes.get(i);
        int p2 = i == primes.size() - 1 ? primes.get(0) : primes.get(i + 1);
        primeMul.add(p1 * p2);
      }

      List<List<Integer>> divisors = new ArrayList<>();
      for (int p : primes) {
        List<Integer> nxt = new ArrayList<>();
        List<Integer> good = new ArrayList<>();
        for (int v : factors) {
          if (v % p == 0 && !primeMul.contains(v)) {
            good.add(v);
          } else {
            nxt.add(v);
          }
        }

        divisors.add(good);
        factors = nxt;
      }
      for (int i = 0; i < primes.size(); i++) {
        // p[i] p[i + 1]
        int p1 = primes.get(i);
        int p2 = i == primes.size() - 1 ? primes.get(0) : primes.get(i + 1);
        List<Integer> div = divisors.get(i);
        res.addAll(div);
        res.add(p1 * p2);
      }
    }

    int cnt = 0;
    for (int i = 0; i < res.size(); i++) {
      int r1 = res.get(i);
      int r2 = i == res.size() - 1 ? res.get(0) : res.get(i + 1);
      long g = gcd(r1, r2);
      if (g == 1) {
        cnt++;
      }
    }

    for (int v : res) {
      out(v + " ");
    }
    outln("");
    outln(cnt);
  }

  // factorization of a long num
  public List<Integer> factor(int N) {
    Set<Integer> res = new HashSet<>();
    for (int i = 2; i * i <= N; i++) {
      while (N % i == 0) {
        res.add(i);
        N = N / i;
      }
    }
    if (N != 1L) {
      res.add(N);
    }

    List<Integer> ls = new ArrayList<>(res);
    Collections.sort(ls);
    return ls;
  }

  void shuffle(int[] a) {
    int n = a.length;
    for(int i = 0; i < n; i++) {
        int r = i + (int) (Math.random() * (n - i));
        int tmp = a[i];
        a[i] = a[r];
        a[r] = tmp;
    }
  }
  long gcd(long a, long b) {
    while(a != 0 && b != 0) {
        long c = b;
        b = a % b;
        a = c;
    }
    return a + b;
  }
  private void outln(Object o) {
      out.println(o);
  }
  private void out(Object o) {
      out.print(o);
  }
  private void formatPrint(double val) {
      outln(String.format("%.9f%n", val));
  }
  public CFA() {
    br = new BufferedReader(new InputStreamReader(System.in));
    out = new PrintWriter(System.out);
    solve();
    out.close();
  }
  public static void main(String[] args) {
      new CFA();
  }

  public long[] nextLongArr(int n) {
    long[] res = new long[n];
    for(int i = 0; i < n; i++)
        res[i] = nextLong();
    return res;
  }
  public int[] nextIntArr(int n) {
    int[] res = new int[n];
    for(int i = 0; i < n; i++)
        res[i] = nextInt();
    return res;
  }
  public String nextToken() {
    while (st == null || !st.hasMoreTokens()) {
        try {
            st = new StringTokenizer(br.readLine());
        } catch (Exception e) {
            eof = true;
            return null;
        }
    }
    return st.nextToken();
  }
  public String nextString() {
    try {
        return br.readLine();
    } catch (IOException e) {
        eof = true;
        return null;
    }
  }
  public int nextInt() {
      return Integer.parseInt(nextToken());
  }
  public long nextLong() {
      return Long.parseLong(nextToken());
  }
  public double nextDouble() {
        return Double.parseDouble(nextToken());
    }
}