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>
#pragma GCC optimize("Ofast,unroll-loops")
#pragma GCC target( \
    "sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
using namespace std;
void itval(istream_iterator<string> it) {}
template <typename T, typename... Args>
void itval(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " = " << a << endl;
  itval(++it, args...);
}
const long long int MOD = 1e9 + 7;
template <typename T>
inline void print(T x) {
  cout << x << "\n";
}
template <typename T>
inline void printvec(T x) {
  for (auto a : x) cout << a << ' ';
  cout << '\n';
}
struct custom {
  bool operator()(const pair<int, pair<int, int> > &p1,
                  const pair<int, pair<int, int> > &p2) const {
    return p1.first < p2.first;
  }
};
long long int get_pow(long long int a, long long int b, long long int M = MOD) {
  long long int res = 1;
  while (b) {
    if (b & 1) res = (res * a) % M;
    a = (a * a) % M;
    b >>= 1;
  }
  return res;
}
const long long int N = 2e5 + 6, inf = 2e18;
void solve() {
  long long int n, x1, x2;
  cin >> n;
  x1 = n, x2 = n;
  std::vector<long long int> primes;
  long long int i = 2;
  map<long long int, long long int> cnt;
  while (i * i <= x1) {
    if (x1 % i == 0) {
      primes.push_back(i);
      int c = 0;
      while (x1 % i == 0) {
        x1 = x1 / i;
        c++;
      }
      cnt[i] = c;
    }
    i++;
  }
  if (x1 > 1) {
    primes.push_back(x1);
    cnt[x1] = 1;
  }
  vector<long long> ans;
  map<long long int, bool> mp;
  long long int m = primes.size(), x;
  vector<bool> used(m, false);
  std::vector<long long int> v[primes.size()], g[m];
  for (long long int i = (long long int)0; i < (long long int)(primes.size());
       i++) {
    x = primes[i];
    for (long long int j = (long long int)0;
         j < (long long int)(cnt[primes[i]]); j++) {
      v[i].push_back(x);
      mp[x] = 1;
      x = x * primes[i];
    }
    if (!mp.count(primes[i] * primes[(i + 1) % m])) {
      g[i].push_back(primes[i] * primes[(i + 1) % m]);
      mp[g[i].back()] = 1;
      used[i] = 1;
    }
  }
  set<long long int> lef;
  int sz = 0;
  for (long long int i = (long long int)1; i < (long long int)(sqrt(x2) + 1);
       i++) {
    if (x2 % i == 0) {
      if (i != 1) {
        if (!mp.count(i)) {
          lef.insert(i);
        }
        sz++;
      }
      if (i * i != x2) {
        if (!mp.count(x2 / i)) {
          lef.insert(x2 / i);
        }
        sz++;
      }
    }
  }
  vector<long long> foo;
  for (long long int i = (long long int)0;
       i < (long long int)(primes.size() - 1); i++) {
    foo.push_back(primes[i] * primes[i + 1]);
  }
  foo.push_back(primes[m - 1] * primes[0]);
  for (auto p : lef) {
    vector<bool> ok(m, false);
    for (long long int i = (long long int)0; i < (long long int)(foo.size());
         i++) {
      if (p % foo[i] == 0) {
        ok[i] = 1;
      }
    }
    bool yes = false;
    for (long long int i = (long long int)0; i < (long long int)(m); i++) {
      if (ok[i] and !used[i]) {
        yes = true;
        g[i].push_back(p);
        used[i] = 1;
        break;
      }
    }
    if (!yes) {
      for (long long int i = (long long int)0; i < (long long int)(m); i++) {
        if (ok[i]) {
          g[i].push_back(p);
          used[i] = 1;
          yes = true;
          break;
        }
      }
    }
    if (!yes) {
      for (long long int i = (long long int)0; i < (long long int)(m); i++) {
        if (p % primes[i] == 0) {
          v[i].push_back(p);
          yes = true;
          break;
        }
      }
    }
    assert(yes);
  }
  for (long long int i = (long long int)0; i < (long long int)(m); i++) {
    for (auto p : v[i]) ans.push_back(p);
    for (auto p : g[i]) ans.push_back(p);
  }
  int res = 0;
  for (long long int i = (long long int)0; i < (long long int)(m); i++)
    if (!used[i]) res++;
  printvec(ans);
  if (m == 1) res = 0;
  cout << res << '\n';
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int test = 1;
  cin >> test;
  clock_t z = clock();
  for (long long int tes = (long long int)0; tes < (long long int)(test);
       tes++) {
    solve();
  }
  fprintf(stderr, "Total Time:%.4f\n", (double)(clock() - z) / CLOCKS_PER_SEC),
      fflush(stderr);
  return 0;
}