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 CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
int prime[110000], num;
bool bn[110000];
void findPrime(int n) {
  int i, j;
  memset(bn, 1, sizeof(bn));
  prime[0] = 2;
  for (i = 2; i < n; i++) {
    if (bn[i]) prime[num++] = i;
    for (j = 0; j < num && i * prime[j] < n; j++) {
      bn[i * prime[j]] = 0;
      if (i % prime[j] == 0) break;
    }
  }
}
int an[110], factorNum;
int pn[110];
void primeFactorization(int a) {
  int i, j;
  memset(pn, 0, sizeof(pn));
  for (i = 0; i < num; i++) {
    int t = prime[i];
    if (a % t == 0) an[++factorNum] = t;
    while (a % t == 0) {
      pn[factorNum]++;
      a /= t;
    }
    if (t * t >= a) break;
  }
  if (a != 1) {
    an[++factorNum] = a;
    pn[factorNum] = 1;
  }
}
set<int> st;
int ansA[20][110000];
int ansAB[20][110000];
void dfs(int k, int ans) {
  int i, j, t;
  if (k > factorNum) {
    st.insert(ans);
    return;
  }
  for (i = 0, t = 1; i <= pn[k]; i++, t *= an[k]) dfs(k + 1, ans * t);
}
int main() {
  num = 0;
  findPrime(110000);
  int z;
  cin >> z;
  while (z--) {
    int n;
    cin >> n;
    int i, j, k;
    int ans;
    factorNum = 0;
    primeFactorization(n);
    if (factorNum == 1) {
      ans = 1;
      for (i = 1; i <= pn[1]; i++) {
        ans *= an[1];
        printf("%d ", ans);
      }
      printf("\n0\n");
    } else if (factorNum == 2) {
      if (pn[1] == 1 && pn[2] == 1) {
        printf("%d %d %d\n1\n", an[1], an[2], an[1] * an[2]);
      } else {
        ans = 1;
        for (i = 1; i <= pn[1]; i++) {
          ans *= an[1];
          printf("%d ", ans);
        }
        printf("%d ", an[1] * an[2]);
        ans = 1;
        for (i = 1; i <= pn[2]; i++) {
          ans *= an[2];
          printf("%d ", ans);
        }
        for (i = 1; i <= pn[1]; i++) {
          for (j = 1; j <= pn[2]; j++) {
            if (i == 1 && j == 1) continue;
            ans = 1;
            for (k = 1; k <= i; k++) ans *= an[1];
            for (k = 1; k <= j; k++) ans *= an[2];
            printf("%d ", ans);
          }
        }
        printf("\n0\n");
      }
    } else {
      dfs(1, 1);
      for (i = 1; i <= factorNum; i++) {
        ansA[i][0] = 0;
        ans = 1;
        for (j = 1; j <= pn[i]; j++) {
          ans *= an[i];
          st.erase(ans);
          ansA[i][++ansA[i][0]] = ans;
        }
        int t;
        if (i != factorNum)
          t = an[i] * an[i + 1];
        else
          t = an[i] * an[1];
        ansAB[i][0] = 0;
        for (auto itr = st.begin(); itr != st.end();) {
          auto tmp = itr;
          itr++;
          if (*tmp % t == 0) {
            ansAB[i][++ansAB[i][0]] = *tmp;
            st.erase(tmp);
          }
        }
      }
      for (i = 1; i <= factorNum; i++) {
        for (auto itr = st.begin(); itr != st.end();) {
          auto tmp = itr;
          itr++;
          if (*tmp % an[i] == 0) {
            ansA[i][++ansA[i][0]] = *tmp;
            st.erase(tmp);
          }
        }
      }
      int sum = 0;
      for (i = 1; i <= factorNum; i++) {
        for (j = 1; j <= ansA[i][0]; j++) printf("%d ", ansA[i][j]);
        for (j = 1; j <= ansAB[i][0]; j++) printf("%d ", ansAB[i][j]);
        sum += ansA[i][0] + ansAB[i][0];
      }
      printf("\n0\n");
    }
  }
  return 0;
}