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;
const int maxn = 1e5;
vector<int> prosti;
int djelitelj[maxn + 100];
void euler() {
  for (int i = 2; i <= maxn; i++) {
    if (!djelitelj[i]) prosti.push_back(i);
    for (int j = 0; i * prosti[j] < maxn; j++) {
      djelitelj[i * prosti[j]] = prosti[j];
      if (i % prosti[j] == 0) break;
    }
  }
  return;
}
int n, pn;
vector<int> pf;
unordered_map<int, bool> mapa;
vector<int> rj;
vector<int> tr_d;
void rek(int tr) {
  tr_d.push_back(tr);
  mapa[tr] = 1;
  for (int i = 0; i < ((int)pf.size()); i++) {
    if ((long long int)tr * pf[i] > n) continue;
    if (mapa[tr * pf[i]]) continue;
    if (n % (tr * pf[i]) == 0) rek(tr * pf[i]);
  }
  return;
}
int gcd(int a, int b) {
  if (!b) return a;
  return gcd(b, a % b);
}
int main() {
  euler();
  ios::sync_with_stdio(0);
  cin.tie(0);
  int t;
  cin >> t;
  for (int tt = 0; tt < (t); tt++) {
    cin >> n;
    pn = n;
    pf.clear();
    rj.clear();
    for (int i = 0; i < ((int)prosti.size()); i++) {
      if (pn % prosti[i] == 0) pf.push_back(prosti[i]);
      while (pn % prosti[i] == 0) pn /= prosti[i];
    }
    if (pn > 1) {
      pf.push_back(pn);
    }
    if ((int)pf.size() == 1) {
      long long int tr = pf[0];
      while (tr <= n) {
        cout << tr << " ";
        tr *= pf[0];
      }
      cout << "\n0\n";
      continue;
    }
    for (int i = (int)pf.size() - 1; i >= 0; i--) {
      tr_d.clear();
      vector<int> novi;
      rek(pf[i]);
      int prvi = -1, drugi = -1;
      for (int j = 0; j < ((int)tr_d.size()); j++) {
        if (i == (int)pf.size() - 1 && tr_d[j] % pf[0] == 0) {
          if (prvi == -1) {
            prvi = tr_d[j];
          } else {
            novi.push_back(tr_d[j]);
          }
        } else if (i > 0 && tr_d[j] % pf[i - 1] == 0) {
          if (drugi == -1) {
            drugi = tr_d[j];
          } else {
            novi.push_back(tr_d[j]);
          }
        } else
          novi.push_back(tr_d[j]);
      }
      if (prvi != -1) rj.push_back(prvi);
      for (int j = 0; j < ((int)novi.size()); j++) rj.push_back(novi[j]);
      if (drugi != -1) rj.push_back(drugi);
    }
    int zad = -1, rj2 = 0;
    for (int i = 0; i < ((int)rj.size()); i++) {
      cout << rj[i] << " ";
      mapa[rj[i]] = 0;
      if (zad != -1) {
        if (gcd(zad, rj[i]) == 1) rj2++;
      }
      zad = rj[i];
    }
    if (gcd(zad, rj[0]) == 1) rj2++;
    cout << "\n";
    cout << rj2 << "\n";
  }
  return 0;
}